repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
sunyymq/crawlers
txsp/echo_ckeyv3.py
#!/usr/bin/env python from encrypt import pack, rand, oi_symmetry_encrypt2 import base64 import random import time KEY = [ 0xfa, 0x82, 0xde, 0xb5, 0x2d, 0x4b, 0xba, 0x31, 0x39, 0x6, 0x33, 0xee, 0xfb, 0xbf, 0xf3, 0xb6 ] def packstr(data): l = len(data) t = [] t.append((l&0xFF00) >> 8) t.appe...
sunyymq/crawlers
txsp/txsp.py
<reponame>sunyymq/crawlers #!/usr/bin/env python from mechanize import Browser from lxml import etree, html import os import random import re import sys import time import urllib import urllib2 import uuid from echo_ckeyv3 import echo_ckeyv3 USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:41.0) Gecko...
tamarakatic/cloud_drive_app
cloud_project/cloud_project/storage_backends.py
from storages.backends.s3boto3 import S3Boto3Storage class StaticStorage(S3Boto3Storage): location = 'documents' file_overwrite = False
tamarakatic/cloud_drive_app
cloud_project/users/views.py
<reponame>tamarakatic/cloud_drive_app<gh_stars>0 from django.shortcuts import render, redirect from django.contrib import messages from django.contrib.auth.decorators import login_required from .forms import UserRegisterForm from .models import Document def document_upload(request): if request.method == 'POST' a...
allenai/manipulathor
ithor_arm/ithor_arm_tasks.py
"""Task Definions for the task of ArmPointNav""" from typing import Dict, Tuple, List, Any, Optional import gym import numpy as np from allenact.base_abstractions.misc import RLStepResult from allenact.base_abstractions.sensor import Sensor from allenact.base_abstractions.task import Task from ithor_arm.ithor_arm_co...
allenai/manipulathor
manipulathor_utils/net_utils.py
import pdb import torch.nn as nn import torch.nn.functional as F def upshuffle( in_planes, out_planes, upscale_factor, kernel_size=3, stride=1, padding=1 ): return nn.Sequential( nn.Conv2d( in_planes, out_planes * upscale_factor ** 2, kernel_size=kernel_size, ...
allenai/manipulathor
ithor_arm/ithor_arm_sensors.py
"""Utility classes and functions for sensory inputs used by the models.""" from typing import Any, Union, Optional import gym import numpy as np from allenact.base_abstractions.sensor import DepthSensor, Sensor, RGBSensor from allenact.base_abstractions.task import Task from allenact.utils.misc_utils import prepare_lo...
allenai/manipulathor
manipulathor_baselines/armpointnav_baselines/experiments/ithor/test_NovelObj_armpointnav_depth.py
from ithor_arm.ithor_arm_task_samplers import ArmPointNavTaskSampler from manipulathor_baselines.armpointnav_baselines.experiments.ithor.armpointnav_depth import ( ArmPointNavDepth, ) from manipulathor_baselines.armpointnav_baselines.experiments.ithor.armpointnav_ithor_base import ( ArmPointNaviThorBaseConfig, ...
allenai/manipulathor
setup.py
from setuptools import find_packages, setup if __name__ == "__main__": setup( name="manipulathor", packages=find_packages(), version="0.0.1", install_requires=[ "allenact==0.2.2", "allenact_plugins[ithor]==0.2.2", "setuptools", ], )
allenai/manipulathor
ithor_arm/arm_calculation_utils.py
<gh_stars>10-100 """Utility classes and functions for calculating the arm relative and absolute position.""" from typing import Dict import numpy as np import torch from scipy.spatial.transform import Rotation as R from ithor_arm.ithor_arm_constants import ( ARM_START_POSITIONS, ADITIONAL_ARM_ARGS, ) def co...
allenai/manipulathor
manipulathor_utils/debugger_util.py
<filename>manipulathor_utils/debugger_util.py import pdb import sys import matplotlib as mpl import torch mpl.use("Agg") import matplotlib.pyplot as plt def visualize_tensor(x, img_name): if len(x.shape) == 3 and x.shape[0] == 3: x = x.transpose(0, 1).transpose(1, 2) x = x.cpu().detach() plt.ims...
allenai/manipulathor
manipulathor_baselines/armpointnav_baselines/experiments/armpointnav_mixin_simplegru.py
from typing import Sequence, Union import gym import torch.nn as nn from allenact.base_abstractions.preprocessor import Preprocessor from allenact.base_abstractions.sensor import RGBSensor, DepthSensor from allenact.utils.experiment_utils import Builder from allenact_plugins.ithor_plugin.ithor_sensors import GoalObjec...
allenai/manipulathor
manipulathor_baselines/armpointnav_baselines/models/arm_pointnav_models.py
"""Baseline models for use in the object navigation task. Object navigation is currently available as a Task in AI2-THOR and Facebook's Habitat. """ from typing import Tuple, Optional import gym import torch from allenact.algorithms.onpolicy_sync.policy import ( ActorCriticModel, LinearCriticHead, LinearA...
allenai/manipulathor
ithor_arm/ithor_arm_constants.py
<gh_stars>10-100 """Constant values and hyperparameters that are used by the environment.""" import ai2thor import ai2thor.fifo_server from allenact_plugins.ithor_plugin.ithor_environment import IThorEnvironment # MANIPULATHOR_COMMIT_ID = "68212159d78aab5c611b7f16338380993884a06a" # MANIPULATHOR_COMMIT_ID = 'bcc2e6297...
allenai/manipulathor
manipulathor_baselines/armpointnav_baselines/experiments/armpointnav_base.py
from abc import ABC from typing import Optional, Sequence, Union from allenact.base_abstractions.experiment_config import ExperimentConfig from allenact.base_abstractions.preprocessor import Preprocessor from allenact.base_abstractions.sensor import Sensor from allenact.utils.experiment_utils import Builder class Ar...
allenai/manipulathor
manipulathor_baselines/armpointnav_baselines/experiments/ithor/test_SeenScenes_NovelObj_armpointnav_depth.py
<filename>manipulathor_baselines/armpointnav_baselines/experiments/ithor/test_SeenScenes_NovelObj_armpointnav_depth.py from ithor_arm.ithor_arm_task_samplers import ArmPointNavTaskSampler from manipulathor_baselines.armpointnav_baselines.experiments.ithor.armpointnav_depth import ( ArmPointNavDepth, ) from manipula...
allenai/manipulathor
manipulathor_constants.py
<reponame>allenai/manipulathor import os from pathlib import Path ABS_PATH_OF_MANIPULATHOR_TOP_LEVEL_DIR = os.path.abspath( os.path.dirname(Path(__file__)) )
allenai/manipulathor
manipulathor_baselines/armpointnav_baselines/experiments/armpointnav_thor_base.py
<reponame>allenai/manipulathor<gh_stars>10-100 import platform from abc import ABC from math import ceil from typing import Dict, Any, List, Optional, Sequence import gym import numpy as np import torch from allenact.base_abstractions.experiment_config import MachineParams from allenact.base_abstractions.preprocessor ...
allenai/manipulathor
manipulathor_baselines/armpointnav_baselines/experiments/ithor/armpointnav_ithor_base.py
<gh_stars>10-100 from abc import ABC from ithor_arm.ithor_arm_constants import TRAIN_OBJECTS, TEST_OBJECTS from manipulathor_baselines.armpointnav_baselines.experiments.armpointnav_thor_base import ( ArmPointNavThorBaseConfig, ) class ArmPointNaviThorBaseConfig(ArmPointNavThorBaseConfig, ABC): """The base co...
KentShikama/covid19-curve-fitting
covidtracking.py
import pandas as pd, numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as ticker from scipy.optimize import curve_fit ASSUMED_RATIO = 0.03 DAYS_TO_PLOT = 400 LOOKBACK = 90 def model(x, a, b, c, d): return a * np.tanh(b * x + c) + d def run(): df = pd.read_json("https://covidtracking.com/ap...
KentShikama/covid19-curve-fitting
deprecated/nytimes.py
import pandas as pd, numpy as np import matplotlib.pyplot as plt from scipy.optimize import curve_fit import math def model(x, a, b, c, d): return a*np.tanh(b*x+c)+d df = pd.read_csv("us-states.csv") all_states = df.groupby("state")["state"].nunique().keys().to_numpy() national_initial_date = pd.to_datetime(df["...
ronrest/graphotti
graphotti/engines/plotly_engine.py
""" POTLY ENGINE """ from . import plotly_funcs as plt COLORS = [ "#4286f4", # blue "#f49a41", # orange "#7cbf5b", # green "#a578ed", # lavender "#ed7d78", # guava "#fce06f", # yellow "#7be5ce", # aqua "#e87df2", # pink "#42874e", # dark green "#8c7646", # honey brown "#314b...
ronrest/graphotti
graphotti/__init__.py
<filename>graphotti/__init__.py<gh_stars>1-10 name = "graphotti" from . plot import * from . import support
ronrest/graphotti
graphotti/engines/mpl_funcs.py
<reponame>ronrest/graphotti import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.dates as mpldates # import seaborn as sns # import numpy as np def setgrid(ax, major=True, minor=False): """ Given an axis object, it sets the grids on """ if major or minor: ax.grid(T...
ronrest/graphotti
graphotti/engines/plotly_funcs.py
<gh_stars>1-10 import numpy as np import pandas as pd from plotly.offline import plot, iplot, init_notebook_mode import plotly.graph_objs as go # init_notebook_mode(connected=True) CATEGORICAL_COLORS = ["blue", "orange", "green", "purple", "red", "pink", "grey"] def create_figure(traces, title, xlabel="x", ylabel="...
ronrest/graphotti
graphotti/support.py
<filename>graphotti/support.py<gh_stars>1-10 import matplotlib def rescale(x, range, newrange=(0,1)): mina, maxa = range minb, maxb = newrange return ((x-mina)/(maxa-mina) * (maxb-minb)) + minb def rgb2hex(x, alpha=False): """ Takes a tuple of rgb values as either: - floats in the range 0-1 ...
ronrest/graphotti
TODOS.py
# TODO: interpret the scaly property in matplotlib engine # TODO: for non-shared axes, have option to position the ticks and labels # on different sides of the plot. # Either: # 1. Automatically alternate sides # 2. Have a property in each individual plot or plotgroup that # allows you ...
ronrest/graphotti
graphotti/plot.py
# TODO: allow addition of more than 2 items # TODO: overlload math operators for PlotGroup as well # TODO: allow addition of PlotGroups with ProtoPlot objects # TODO: allow addition PlotGroups # TODO: i think that the `share` property might be better stored in the PlotGroup # object rather than the ProtoPlot obj...
ronrest/graphotti
graphotti/engines/mpl_engine.py
""" MATPLOTLIB ENGINE """ from . import mpl_funcs as plt COLORS = [ "#4286f4", # blue "#f49a41", # orange "#7cbf5b", # green "#a578ed", # lavender "#ed7d78", # guava "#fce06f", # yellow "#7be5ce", # aqua "#e87df2", # pink "#42874e", # dark green "#8c7646", # honey brown "#31...
ronrest/graphotti
graphotti/engines/__init__.py
from . mpl_engine import MPLEngine from . plotly_engine import PlotlyEngine mpl = MPLEngine() plotly = PlotlyEngine() enginemap = dict( mpl = mpl, ply=plotly, plotly=plotly, ) class ProtoEngine(object): def __init__(): pass def plot(self, compiled): raise NotImplementedError...
rosie-duffin/exceptiontype
exceptiontype.py
<reponame>rosie-duffin/exceptiontype import sys random = ['a',0,2] for i in random: try: print("The entry is",i) r=1/int(i) break except: print("Warning!",sys.exc_info()[0],"occurred.") print("Next entry.") print()
grandoba/rpg_feature_tracking_analysis
big_pun/tracker_init.py
<gh_stars>10-100 import yaml from dataset import Dataset import numpy as np from tracker_utils import backProjectFeatures, grid_sample, filter_first_tracks from tracks import Tracks import os class TrackerInitializer: def __init__(self, root, dataset_yaml, config_yaml=None, config=None): if config is None...
konerunatwar/Making-ML-App-With-Fast-API-And-No-CodeAPP-Using-Bravo-studios
Hyd-App-API/values.py
from pydantic import BaseModel class value(BaseModel): property_size: int bhk: int property_age: int gym: str lift: str swimmingPool: str location: str deviceid: str
konerunatwar/Making-ML-App-With-Fast-API-And-No-CodeAPP-Using-Bravo-studios
Hyd-App-API/app.py
# Importing Required Libraries import uvicorn from fastapi import FastAPI from values import value import numpy as np import pickle import pandas as pd import json import requests import time app = FastAPI() # Importing pickle_in = open("hyd_prices.pickle","rb") model=pickle.load(pickle_in) f = open('...
Saketa13/STOCKPREDICITION
app.py
from tensorflow import keras import pandas as pd from flask import Flask, render_template, request,url_for,redirect import numpy as np from tqdm import tqdm import tensorflow as tf #import matplotlib.pyplot as plt import os app = Flask(__name__) app.config['UPLOAD_FOLDER']='' @app.route("/") def index(): ret...
ShirleiMachado/wishlist_project_API
populate_script.py
import os, django os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'wishlist_api.settings') django.setup() from faker import Faker import random from wishlist_app.models import Client, Product def creating_clients(clients_number): fake = Faker('pt_BR') Faker.seed(10) for _ in range(clients_number): ...
ShirleiMachado/wishlist_project_API
wishlist_app/migrations/0001_initial.py
# Generated by Django 3.1.4 on 2020-12-18 17:47 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Client', fields=[ ...
ShirleiMachado/wishlist_project_API
wishlist_app/admin.py
from django.contrib import admin from wishlist_app.models import Client, Product, Fav_Product class Clients(admin.ModelAdmin): list_display = ('id', 'name', 'email') list_display_links = ('id', 'name') search_fields = ['name', 'email'] list_per_page = 10 admin.site.register(Client, Clients) class ...
ShirleiMachado/wishlist_project_API
wishlist_app/models.py
<reponame>ShirleiMachado/wishlist_project_API<filename>wishlist_app/models.py<gh_stars>1-10 from django.db import models class Client(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(max_length=150) email = models.EmailField(blank=False, max_length=150, unique=True) def __str__(s...
ShirleiMachado/wishlist_project_API
wishlist_app/serializers.py
<filename>wishlist_app/serializers.py from rest_framework import serializers from wishlist_app.models import Client, Product, Fav_Product #from wishlist_app.validators import * class ClientSerializer(serializers.ModelSerializer): class Meta: model = Client fields = '__all__' def validate(self,d...
ShirleiMachado/wishlist_project_API
wishlist_app/views.py
from rest_framework import viewsets, generics, filters from wishlist_app.models import Client, Product, Fav_Product from wishlist_app.serializers import ClientSerializer, ProductSerializer, FavProductSerializer from rest_framework.authentication import BasicAuthentication from rest_framework.permissions import IsAuthen...
rpatel10491/web-scraping-challenge
scrape_mars.py
import pandas as pd import requests import html import time from bs4 import BeautifulSoup from splinter import Browser executable_path = {"executable_path": "chromedriver"} def scrape_info(): browser = Browser('chrome', **executable_path, headless=True) url = 'https://mars.nasa.gov/news/' browser.visit...
Vl-tb/Puzzle-Game
puzzle.py
<reponame>Vl-tb/Puzzle-Game ''' This module contains functions.https://github.com/Vl-tb/Puzzle-Game ''' def check_horizontally(board: list) -> bool: ''' This function checks if every line of board has no repetitions of same numbers and returns True or False, depending on board. ''' for i in range(le...
JJMinton/dagster
examples/hacker_news/hacker_news_tests/test_resources/test_snowflake_io_manager.py
<filename>examples/hacker_news/hacker_news_tests/test_resources/test_snowflake_io_manager.py import os import uuid from contextlib import contextmanager from dagster import build_init_resource_context, build_input_context, build_output_context from hacker_news.resources.snowflake_io_manager import connect_snowflake, s...
JJMinton/dagster
python_modules/dagster/dagster/core/log_manager.py
<reponame>JJMinton/dagster<filename>python_modules/dagster/dagster/core/log_manager.py import datetime import logging from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional from dagster import check from dagster.core.utils import coerce_valid_log_level, make_new_run_id if TYPE_CHECKING: from dags...
JJMinton/dagster
examples/docs_snippets_crag/docs_snippets_crag_tests/guides_tests/graph_job_op_tests/test_graph_job_op_examples.py
from dagster import build_schedule_context, execute_pipeline from docs_snippets_crag.guides.dagster.graph_job_op import ( composite_solid, graph_job_test, graph_with_config, graph_with_config_and_schedule, graph_with_config_mapping, graph_with_partition_schedule, graph_with_resources, gr...
JJMinton/dagster
.buildkite/dagster-buildkite/dagster_buildkite/cli.py
<reponame>JJMinton/dagster<filename>.buildkite/dagster-buildkite/dagster_buildkite/cli.py from .defines import DO_COVERAGE from .steps.dagit import dagit_steps from .steps.dagster import coverage_step, dagster_steps from .steps.integration import integration_steps from .steps.trigger import trigger_step from .steps.wai...
svupper/TradingGym
trading_env/envs/training_v1.py
<gh_stars>0 import os import logging import numpy as np import pandas as pd import matplotlib import matplotlib.pyplot as plt import matplotlib.patches as patches from colour import Color class trading_env: def __init__(self, env_id, obs_data_len, step_len, df, fee, max_position=5, deal_col_name...
willdickson/serial_delay_test
python/serial_delay_test/serial_delay_test/__init__.py
from .serial_delay_test import SerialDelayTest
willdickson/serial_delay_test
python/serial_delay_test/serial_delay_test/serial_delay_test.py
<reponame>willdickson/serial_delay_test from __future__ import print_function import time import serial import numpy as np import matplotlib.pyplot as plt class SerialDelayTest(serial.Serial): Baudrate = 115200 BusyWaitSleepDt = 0.05 DefaultTimeout = 10.0 DefaultResetSleep = 2.0 DefaultGearRatio =...
willdickson/serial_delay_test
python/serial_delay_test/examples/run_test.py
import sys from serial_delay_test import SerialDelayTest if len(sys.argv) > 1: port = sys.argv[1] else: port = '/dev/ttyUSB0' test = SerialDelayTest(port) test.run(1000)
xyb/robotframework-debuglibrary
DebugLibrary/version.py
VERSION = '2.2.2'
ANCIR/aleph
aleph/analysis/aggregate.py
import logging from Levenshtein import setmedian from aleph.analysis.util import tag_key from aleph.analysis.util import TAG_COUNTRY, TAG_LANGUAGE, TAG_PHONE from aleph.analysis.util import TAG_PERSON, TAG_COMPANY log = logging.getLogger(__name__) class TagAggregator(object): MAX_TAGS = 10000 CUTOFFS = { ...
ANCIR/aleph
aleph/analysis/extract.py
<gh_stars>1-10 import spacy import logging from banal import ensure_list from normality import collapse_spaces from fingerprints import clean_entity_name from followthemoney.types import registry from aleph.core import settings, kv from aleph.analysis.util import check_text_length from aleph.analysis.util import tag_k...
ANCIR/aleph
aleph/logic/processing.py
<gh_stars>1-10 import logging from banal import is_mapping, ensure_list from followthemoney import model from followthemoney.exc import InvalidData from followthemoney.pragma import remove_checksums from aleph.model import Entity, Document from aleph.queues import ingest_entity from aleph.analysis import analyze_entit...
ANCIR/aleph
aleph/views/alerts_api.py
from flask import Blueprint, request from aleph.core import db from aleph.model import Alert from aleph.search import DatabaseQueryResult from aleph.views.serializers import AlertSerializer from aleph.views.util import require, obj_or_404 from aleph.views.util import parse_request from aleph.views.context import tag_r...
ANCIR/aleph
aleph/oauth.py
<reponame>ANCIR/aleph import jwt from urllib.request import urlopen import base64 import json import logging from authlib.integrations.flask_client import OAuth from cryptography.x509 import load_pem_x509_certificate from cryptography.hazmat.backends import default_backend from aleph import signals, settings oauth = ...
ANCIR/aleph
aleph/analysis/util.py
<reponame>ANCIR/aleph import io import csv import logging from normality import normalize from servicelayer.cache import make_key from aleph.core import settings, kv log = logging.getLogger(__name__) PLACE_KEY = 'ner*gns' TAG_PERSON = 'peopleMentioned' TAG_COMPANY = 'companiesMentioned' TAG_LANGUAGE = 'detectedLangu...
ANCIR/aleph
aleph/logic/collections.py
<filename>aleph/logic/collections.py import logging from datetime import datetime from aleph.core import db, cache from aleph.authz import Authz from aleph.queues import cancel_queue from aleph.model import Collection, Entity, Document, Match from aleph.model import Permission, Events from aleph.index import collectio...
ANCIR/aleph
aleph/analysis/patterns.py
<gh_stars>1-10 import re from banal import ensure_list from followthemoney.types import registry from aleph.analysis.util import TAG_EMAIL, TAG_PHONE from aleph.analysis.util import TAG_IBAN, TAG_COUNTRY EMAIL_REGEX = re.compile(r'[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}', re.IGNORECASE) # noqa PHONE_REGEX = re.compil...
ANCIR/aleph
aleph/views/stream_api.py
import logging from banal import ensure_list from flask.wrappers import Response from flask import Blueprint, request from aleph.index.entities import iter_entities from aleph.logic.rdf import export_collection from aleph.views.util import get_db_collection from aleph.views.util import require, stream_ijson log = log...
ANCIR/aleph
aleph/views/roles_api.py
<gh_stars>1-10 import logging from flask_babel import gettext from flask import Blueprint, request from itsdangerous import BadSignature from werkzeug.exceptions import BadRequest from aleph.core import db, settings from aleph.authz import Authz from aleph.search import QueryParser, DatabaseQueryResult from aleph.mode...
ANCIR/aleph
aleph/model/role.py
<reponame>ANCIR/aleph import logging from datetime import datetime from normality import stringify from sqlalchemy import or_, not_, func from itsdangerous import URLSafeTimedSerializer from werkzeug.security import generate_password_hash, check_password_hash from aleph.core import db, settings from aleph.model.common...
ANCIR/aleph
aleph/analysis/__init__.py
<filename>aleph/analysis/__init__.py import logging from followthemoney.types import registry from aleph.core import settings from aleph.model import Document, Entity from aleph.analysis.aggregate import TagAggregator from aleph.analysis.extract import extract_entities from aleph.analysis.patterns import extract_patte...
ANCIR/aleph
aleph/tests/test_ingest_api.py
import json from io import BytesIO from pprint import pprint # noqa from aleph.model import Document from aleph.tests.util import TestCase from aleph.queues import get_status, get_stage, OP_INGEST, OP_PROCESS from aleph.logic.processing import process_collection class IngestApiTestCase(TestCase): def setUp(sel...
ANCIR/aleph
aleph/analysis/language.py
<filename>aleph/analysis/language.py import logging import fasttext from normality import collapse_spaces from aleph.core import settings from aleph.analysis.util import TEXT_MIN_LENGTH, TEXT_MAX_LENGTH log = logging.getLogger(__name__) THRESHOLD = 0.6 def detect_languages(entity, texts): """Given a list of lin...
maet3608/fast-pfp
fastpfp/example.py
""" .. module:: example :synopsis: A usage example """ from __future__ import print_function from fastpfp.util import graph2matrices from fastpfp.match import match_graphs if __name__ == '__main__': L1, A1 = graph2matrices([[0], [1], [2], [3]], [(0, 1), (0, 2), (2, 3)]) L2, A2 = graph2matrices([[1], [0], [2...
maet3608/fast-pfp
tests/test_util.py
""" .. module:: test_util :synopsis: Unit tests for util module """ import numpy as np from fastpfp.util import graph2matrices, adj_matrix2edges def test_graph2matrices(): L, A = graph2matrices(4, [(0, 1), (0, 2)]) L_expected = np.array([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0]]) A_expected = np.arr...
maet3608/fast-pfp
fastpfp/match.py
<reponame>maet3608/fast-pfp """ .. module:: match :synopsis: Implements the graph matching algorithm described in https://arxiv.org/pdf/1207.1114 using numpy and Pytorch """ from __future__ import print_function import numpy as np from fastpfp.util import datatype from torch import mm, ...
maet3608/fast-pfp
fastpfp/util.py
<reponame>maet3608/fast-pfp """ .. module:: util :synopsis: Utility functions """ import numpy as np import torch.cuda as cuda from torch import FloatTensor def datatype(device_id): """ Return tensor data type for CPU or GPU. :param int|None device_id: Device to create datatype for. None: auto...
maet3608/fast-pfp
tests/test_match.py
<filename>tests/test_match.py """ .. module:: test_fastpfp :synopsis: Unit tests for fastpfp module """ import numpy as np from fastpfp.util import graph2matrices from fastpfp.match import num_nodes, match_graphs, pfp, discretize def test_num_nodes(): L1, A1 = graph2matrices(4, [(0, 1), (0, 2), (2, 3)]) ...
reddec/iop
iop/ipc/output.py
from iop.ipc.input import _Direct async def direct(destination, message, wait=True): d = _Direct.get(destination) if wait: return await d.queue.put(message) return d.queue.put_nowait(message)
reddec/iop
iop/runner/main.py
import asyncio import os import sys import logging import argparse from iop.core import flows from iop.core.util import Stop async def mont_flow(flow, module, penalty): logger = logging.getLogger(module) logger.info("started") while True: try: await flow() except Stop: ...
reddec/iop
setup.py
<gh_stars>0 from setuptools import setup, find_packages from os import path here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() setup( name='iop', version='0.0.4', description='Input-Output processing: Apache Camel on...
reddec/iop
iop/input/mail.py
<reponame>reddec/iop<gh_stars>0 from aioimaplib import aioimaplib from iop.core.message import Message import asyncio import email import email.header import email.utils class MailBox: def __init__(self, user: str, password: str, server: str): self.user = user self.password = password self...
reddec/iop
iop/core/message.py
import time class Headers(dict): __getattr__ = dict.get __setattr__ = dict.__setitem__ __delattr__ = dict.__delitem__ class Message: def __init__(self, payload=None, msgid: str = None, **headers): self.payload = payload self.msgid = str(msgid or time.time()) self.headers = He...
reddec/iop
iop/ipc/input.py
<gh_stars>0 import asyncio class _Direct: items = {} def __init__(self): self.queue = asyncio.Queue(1) @staticmethod def get(name): d = _Direct.items.get(name, None) if d is None: d = _Direct() _Direct.items[name] = d return d async def direc...
reddec/iop
iop/process/render.py
import datetime import os import socket def setup_env(env): pass def default_params(): return { "now": datetime.datetime.now(), "host": socket.getfqdn(), "env": os.environ } def template(text, **params): import jinja2 env = jinja2.Environment(loader=jinja2.BaseLoader())...
reddec/iop
iop/core/util.py
<filename>iop/core/util.py<gh_stars>0 class Stop(RuntimeError): pass def stop(): raise Stop()
reddec/iop
iop/core/__init__.py
<filename>iop/core/__init__.py import asyncio flows = [] def flow(f): if asyncio.iscoroutinefunction(f): flows.append((f, f.__module__.split('.')[-1] + "." + f.__name__)) return f
reddec/iop
iop/input/scheduler.py
import asyncio import time from iop.core.message import Message async def timer(interval: int) -> Message: await asyncio.sleep(interval) return Message(time.time())
escrichov/images
tests/test_images.py
<reponame>escrichov/images import json import re import uuid import os from falcon.testing import TestBase import falcon from app import ( api, STORAGE_PATH, ) CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) FIXTURES_DIR = os.path.join(CURRENT_DIR, 'fixtures') VALID_IMAGE_NAME = re.compile(r'[a-f0...
escrichov/images
app.py
import os from wsgiref import simple_server import falcon import images api = application = falcon.API() CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) STORAGE_PATH = os.path.join(CURRENT_DIR, 'uploads') image_collection = images.Collection(STORAGE_PATH) image = images.Item(STORAGE_PATH) api.add_route...
escrichov/images
images.py
import os import time import uuid import re import falcon ALLOWED_IMAGE_TYPES = ( 'image/gif', 'image/jpeg', 'image/png', ) VALID_IMAGE_NAME = re.compile(r'[a-f0-9]{32}\.(jpeg|gif|png)$') def validate_image_type(req, resp, params): if req.content_type not in ALLOWED_IMAGE_TYPES: msg = 'Im...
pszhuchkov/language-salary
main.py
import argparse import os import sys import time import requests from dotenv import load_dotenv from itertools import count from requests.exceptions import ConnectionError, HTTPError from terminaltables import AsciiTable HH_API_URL = 'https://api.hh.ru/vacancies/' SJ_API_URL = 'https://api.superjob.ru/2.0/vacancies...
atharvajoshi1007/ExpressiveTTS
Trials/TTS1.py
<reponame>atharvajoshi1007/ExpressiveTTS import pyttsx3 engine = pyttsx3.init() engine.say('khopdi tod saale ka') engine.runAndWait()
proyecto-sysmana/sysmana2018
streamSearch.py
<reponame>proyecto-sysmana/sysmana2018 # # Escucha en tiempo real y almacena los tweets en un fichero de texto # import tweepy import codecs from secret import * api = init_twitter('sysmanapy') #### PASO 1 (Pasamos por parámetro el usuario del cual cogerá las credenciales en el fichero secret) class MyStreamListener(...
proyecto-sysmana/sysmana2018
control.py
<reponame>proyecto-sysmana/sysmana2018 #!/usr/bin/env python # -*- coding: utf-8 -*- # devuelve un analisis de las relaciones de un usuario en base a un historico previo (seguidores, amigos, seguidores inactivos, antiguos seguidores...) import sys, tweepy, shelve, datetime, traceback import itertools # Librería de Pyt...
proyecto-sysmana/sysmana2018
horasActivas.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ### Devuelve una estimacion en base a 200 tweets de las horas a las que suele conectarse un usuario import tweepy, codecs, sys from secret import * api = init_twitter('sysmanapy'); if len(sys.argv) != 2: sys.exit('Usage: '+sys.argv[0]+' twitter_user') else: user = sy...
proyecto-sysmana/sysmana2018
retuitea.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # recoge de un fichero los tweets para irlos retwiteando cada vez que ejecutemos el script # >> retuitewa.py -f fichero.txt import sys if 'idlelib.rpc' in sys.modules: sys.argv.extend(raw_input("Args: ").split()) import tweepy from secret import * # Se comp...
proyecto-sysmana/sysmana2018
getLocation.py
#!/usr/bin/env python # -*- coding: utf-8 -*- #obtenemos la localizacion de los tweets que recoja nuestro filtro import tweepy import codecs from secret import * api = init_twitter('sysmanapy') class MyStreamListener(tweepy.StreamListener): def on_status(self, status): #recogemos todos los tweets que contengan el...
proyecto-sysmana/sysmana2018
favorite.py
<filename>favorite.py #Manda un fav a los tweets que contengan el patron import tweepy import codecs from secret import * api = init_twitter('sysmanapy') class MyStreamListener(tweepy.StreamListener): def on_status(self, status): print('Autor: '+status.user.screen_name) print('Estado: \n'+status.text) ...
proyecto-sysmana/sysmana2018
secret.py
import tweepy #Authentication keys credentials ={ 'nieves': { 'consumer_key' : '', 'consumer_secret' : '', 'access_token' : '-', 'access_token_secret' : '' }, 'pablo': { 'consumer_key' : '', 'consumer_secret' : '', 'access_token' : '-', 'access_token_secret' : '' }, 'sysmanapy': { ...
spohnan/geowave
python/src/main/python/pygw/test/conftest.py
# # Copyright (c) 2013-2019 Contributors to the Eclipse Foundation # # See the NOTICE file distributed with this work for additional information regarding copyright # ownership. All rights reserved. This program and the accompanying materials are made available # under the terms of the Apache License, Version 2.0 which...
spohnan/geowave
python/src/main/python/pygw/geotools/simple_feature.py
<filename>python/src/main/python/pygw/geotools/simple_feature.py<gh_stars>0 # # Copyright (c) 2013-2019 Contributors to the Eclipse Foundation # # See the NOTICE file distributed with this work for additional information regarding copyright # ownership. All rights reserved. This program and the accompanying materials a...
spohnan/geowave
python/src/main/python/pygw/config.py
# # Copyright (c) 2013-2019 Contributors to the Eclipse Foundation # # See the NOTICE file distributed with this work for additional information regarding copyright # ownership. All rights reserved. This program and the accompanying materials are made available # under the terms of the Apache License, Version 2.0 which...
spohnan/geowave
python/src/main/python/pygw/base/__init__.py
<reponame>spohnan/geowave # # Copyright (c) 2013-2019 Contributors to the Eclipse Foundation # # See the NOTICE file distributed with this work for additional information regarding copyright # ownership. All rights reserved. This program and the accompanying materials are made available # under the terms of the Apache ...
spohnan/geowave
python/src/main/python/pygw/store/bigtable/big_table_options.py
<reponame>spohnan/geowave # # Copyright (c) 2013-2019 Contributors to the Eclipse Foundation # # See the NOTICE file distributed with this work for additional information regarding copyright # ownership. All rights reserved. This program and the accompanying materials are made available # under the terms of the Apache ...
spohnan/geowave
python/src/main/python/pygw/geotools/__init__.py
<reponame>spohnan/geowave<gh_stars>0 # # Copyright (c) 2013-2019 Contributors to the Eclipse Foundation # # See the NOTICE file distributed with this work for additional information regarding copyright # ownership. All rights reserved. This program and the accompanying materials are made available # under the terms of ...
spohnan/geowave
python/src/main/python/pygw/store/__init__.py
<reponame>spohnan/geowave # # Copyright (c) 2013-2019 Contributors to the Eclipse Foundation # # See the NOTICE file distributed with this work for additional information regarding copyright # ownership. All rights reserved. This program and the accompanying materials are made available # under the terms of the Apache ...