repo_name
stringlengths
7
94
repo_path
stringlengths
4
237
repo_head_hexsha
stringlengths
40
40
content
stringlengths
10
680k
apis
stringlengths
2
680k
Aerdan/adventcode-2020
python/day5-1.py
83120aa8c7fc9d1f2d34780610401e3c6d4f583b
#!/usr/bin/env python3 def binary(code, max, bits): ret = [] for i in range(max): ret.append(bits[code[i]]) return int(''.join(ret), base=2) mid = 0 with open('input5.txt') as f: for line in f.readlines(): line = line[:-1] row = binary(line[:7], 7, {'F': '0', 'B': '1'}) ...
[]
baramsalem/Custom-stocks-py
custom_stocks_py/base.py
5beeb7b6f93755ec7c00c25763accf6a52f8bbaf
""" custom_stocks_py base module. This is the principal module of the custom_stocks_py project. here you put your main classes and objects. Be creative! do whatever you want! If you want to replace this with a Flask application run: $ make init and then choose `flask` as template. """ class BaseClass: de...
[]
dpmkl/heimdall
dummy_server.py
184f169f0be9f6b6b708364725f5db8b1f249d9c
#!/usr/bin/env python import SimpleHTTPServer import SocketServer import logging PORT = 8000 class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): def do_GET(self): self.send_response(200) self.send_header('Content-type','text/html') self.end_headers() self.wfile.write("Hel...
[((428, 475), 'SocketServer.TCPServer', 'SocketServer.TCPServer', (["('', PORT + i)", 'Handler'], {}), "(('', PORT + i), Handler)\n", (450, 475), False, 'import SocketServer\n')]
nalu-svk/cimsparql
cimsparql/__init__.py
e69b0799a2bbd70027e2c8bb9970574991597ca5
"""Library for CIM sparql queries""" __version__ = "1.9.0"
[]
jmviz/xd
scripts/49-cat-logs.py
f905e5c61b2835073b19cc3fa0d6917432fa7ece
#!/usr/bin/env python3 # Usage: # $0 -o log.txt products/ # # concatenates .log files (even those in subdirs or .zip) and combines into a single combined.log from xdfile.utils import find_files_with_time, open_output, get_args import boto3 # from boto.s3.connection import S3Connection import os def main(): a...
[((326, 363), 'xdfile.utils.get_args', 'get_args', (['"""aggregates all .log files"""'], {}), "('aggregates all .log files')\n", (334, 363), False, 'from xdfile.utils import find_files_with_time, open_output, get_args\n'), ((375, 388), 'xdfile.utils.open_output', 'open_output', ([], {}), '()\n', (386, 388), False, 'fro...
wuyang1002431655/tango_with_django_19
manuscript/link_checker.py
42d5878e4a12037daf04d785826357cd4351a16d
# Checks for broken links in the book chapters, printing the status of each link found to stdout. # The Python package 'requests' must be installed and available for this simple module to work. # Author: David Maxwell # Date: 2017-02-14 import re import requests def main(chapters_list_filename, hide_success=True): ""...
[]
2890841438/fast-index.py
service/__init__.py
fa59f38ed009b4bdf5dbf27d8619d31f8b681118
# -*- coding = utf-8 -*- # @Time: 2020/9/4 18:52 # @Author: dimples_yj # @File: __init__.py.py # @Software: PyCharm
[]
HermannLiang/CLIP-ViL
CLIP-ViL-Direct/vqa/pythia_clip_grid_feature.py
49c28bc5ece1aacfcbfd9c8810db70663ca0516a
#!/usr/bin/env python3 """ Grid features extraction script. """ import argparse import os import torch import tqdm from fvcore.common.file_io import PathManager from detectron2.checkpoint import DetectionCheckpointer from detectron2.config import get_cfg from detectron2.engine import default_setup from detectron2.eva...
[((1494, 1556), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Grid feature extraction"""'}), "(description='Grid feature extraction')\n", (1517, 1556), False, 'import argparse\n'), ((3454, 3463), 'detectron2.config.get_cfg', 'get_cfg', ([], {}), '()\n', (3461, 3463), False, 'from detect...
aerendon/blockchain-basics
src/node.py
e3168afd097b26d23a09fd30e74e07b695e577d1
from flask import Flask, request import time import requests import json from blockchain import Blockchain from block import Block app = Flask(__name__) blockchain = Blockchain() peers = set() @app.route('/add_nodes', methods=['POST']) def register_new_peers(): nodes = request.get_json() if not nodes: ...
[((139, 154), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (144, 154), False, 'from flask import Flask, request\n'), ((169, 181), 'blockchain.Blockchain', 'Blockchain', ([], {}), '()\n', (179, 181), False, 'from blockchain import Blockchain\n'), ((279, 297), 'flask.request.get_json', 'request.get_json', ...
Nilzone-/Knowit-Julekalender-2017
Luke 02/02.py
66ef8a651277e0fef7d9278f3f129410b5b98ee0
import numpy as np size = 1000 def create_wall(x, y): return "{0:b}".format(x**3 + 12*x*y + 5*x*y**2).count("1") & 1 def build_grid(): return np.array([create_wall(j+1, i+1) for i in range(size) for j in range(size)]).reshape(size, size) def visit(grid, x=0, y=0): if grid[x][y]: return grid[x][y] = 1 ...
[]
danielicapui/programa-o-avancada
databases/music.py
d0e5b876b951ae04a46ffcda0dc0143e3f7114d9
from utills import * conn,cur=start('music') criarTabela("tracks","title text,plays integer") music=[('trunder',20), ('my way',15)] insertInto("tracks","title,plays",music) #cur.executemany("insert into tracks (title,plays) values (?,?)",music) buscaTabela("tracks","title") conn.commit() conn.close()
[]
pdxcycling/carv.io
video_analysis/code/scene_postprocess.py
cce0f91a76d3ceed714b3625d415131fd9540899
import pandas as pd import numpy as np import re from collections import Counter from flow_preprocess import FlowPreprocess class ScenePostprocess(object): """ Heavy-lifting macro-feature class """ def __init__(self, flow_df, quality_df, remove_transitions=False): """ Default construct...
[((951, 994), 'flow_preprocess.FlowPreprocess.flow_distances', 'FlowPreprocess.flow_distances', (['self.flow_df'], {}), '(self.flow_df)\n', (980, 994), False, 'from flow_preprocess import FlowPreprocess\n'), ((1027, 1067), 'flow_preprocess.FlowPreprocess.flow_angles', 'FlowPreprocess.flow_angles', (['self.flow_df'], {}...
ThomasRot/rational_activations
examples/pytorch/mnist/plot.py
1fa26d1ee5f3c916eda00c899afa96eccb960143
import torch import numpy as np import pickle torch.manual_seed(17) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False np.random.seed(17) import argparse import torch.nn as nn import torch.nn.functional as F import matplotlib import os from rational.torch import Rational, RecurrentRationa...
[((47, 68), 'torch.manual_seed', 'torch.manual_seed', (['(17)'], {}), '(17)\n', (64, 68), False, 'import torch\n'), ((150, 168), 'numpy.random.seed', 'np.random.seed', (['(17)'], {}), '(17)\n', (164, 168), True, 'import numpy as np\n'), ((592, 621), 'matplotlib.rc', 'matplotlib.rc', (['"""font"""'], {}), "('font', **fo...
AetherBlack/Veille-Informatique
fts/fluxrss.py
e80451c5eb21f43ac1a9baac3342ad0d4102d18b
#!/usr/bin/python3 from urllib.parse import urlparse import feedparser import requests import asyncio import discord import hashlib import os from const import CHANNEL_RSS, WAIT_UNTIL_NEW_CHECK, \ SQLITE_FOLDER_NAME, SQLITE_FILE_NAME from fts.database import Database from fts.cleandatabase import CleanDatabase ...
[((866, 908), 'os.path.join', 'os.path.join', (['self.cwd', 'SQLITE_FOLDER_NAME'], {}), '(self.cwd, SQLITE_FOLDER_NAME)\n', (878, 908), False, 'import os\n'), ((933, 973), 'fts.database.Database', 'Database', (['self.db_path', 'SQLITE_FILE_NAME'], {}), '(self.db_path, SQLITE_FILE_NAME)\n', (941, 973), False, 'from fts....
kiyohiro8/poke-env
src/poke_env/player/player_network_interface.py
7a1a4b155e8a73bd712d44e70c4192f8032d7e6f
# -*- coding: utf-8 -*- """This module defines a base class for communicating with showdown servers. """ import json import logging import requests import websockets # pyre-ignore from abc import ABC from abc import abstractmethod from asyncio import CancelledError from asyncio import ensure_future from asyncio impo...
[((2127, 2134), 'asyncio.Event', 'Event', ([], {}), '()\n', (2132, 2134), False, 'from asyncio import Event\n'), ((2164, 2170), 'asyncio.Lock', 'Lock', ([], {}), '()\n', (2168, 2170), False, 'from asyncio import Lock\n'), ((3563, 3596), 'logging.getLogger', 'logging.getLogger', (['self._username'], {}), '(self._usernam...
Keesiu/meta-kaggle
data/external/repositories/42139/KDDCup13Track2-master/blocking.py
87de739aba2399fd31072ee81b391f9b7a63f540
#!/usr/bin/env python from common import * import csv import argparse from unidecode import unidecode from nameparser import constants as npc from collections import defaultdict import cPickle as pickle import re stopwords_custom = set(['document', 'preparation', 'system', 'consortium', 'committee', 'international', '...
[]
basepipe/developer_onboarding
resources/dot_PyCharm/system/python_stubs/-762174762/PySide/QtCore/QAbstractFileEngineIterator.py
05b6a776f8974c89517868131b201f11c6c2a5ad
# encoding: utf-8 # module PySide.QtCore # from C:\Python27\lib\site-packages\PySide\QtCore.pyd # by generator 1.147 # no doc # imports import Shiboken as __Shiboken class QAbstractFileEngineIterator(__Shiboken.Object): # no doc def currentFileInfo(self, *args, **kwargs): # real signature unknown pas...
[]
priyatharsan/beyond
tests/conftest.py
1061b870407d316d43e4d1351a7ec026629685ae
import numpy as np from pytest import fixture, mark, skip from unittest.mock import patch from pathlib import Path from beyond.config import config from beyond.dates.eop import Eop from beyond.frames.stations import create_station from beyond.io.tle import Tle from beyond.propagators.keplernum import KeplerNum from be...
[((400, 434), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'linewidth': '(200)'}), '(linewidth=200)\n', (419, 434), True, 'import numpy as np\n'), ((438, 476), 'pytest.fixture', 'fixture', ([], {'autouse': '(True)', 'scope': '"""session"""'}), "(autouse=True, scope='session')\n", (445, 476), False, 'from pyte...
Electric-tric/diofant
diofant/tests/integrals/test_heurisch.py
92c4bf0ef301e5d6f0cfab545b036e1cb7de3c0a
import pytest from diofant import (Add, Derivative, Ei, Eq, Function, I, Integral, LambertW, Piecewise, Rational, Sum, Symbol, acos, asin, asinh, besselj, cos, cosh, diff, erf, exp, li, log, pi, ratsimp, root, simplify, sin, sinh, sqrt, symbols, tan) from ...
[((423, 442), 'diofant.symbols', 'symbols', (['"""x,y,z,nu"""'], {}), "('x,y,z,nu')\n", (430, 442), False, 'from diofant import Add, Derivative, Ei, Eq, Function, I, Integral, LambertW, Piecewise, Rational, Sum, Symbol, acos, asin, asinh, besselj, cos, cosh, diff, erf, exp, li, log, pi, ratsimp, root, simplify, sin, si...
carlosb1/kornia
kornia/color/adjust.py
a2b34d497314e7ed65f114401efdd3cc9ba2077c
from typing import Union import torch import torch.nn as nn from kornia.color.hsv import rgb_to_hsv, hsv_to_rgb from kornia.constants import pi def adjust_saturation_raw(input: torch.Tensor, saturation_factor: Union[float, torch.Tensor]) -> torch.Tensor: r"""Adjust color saturation of an image. Expecting input ...
[((1212, 1248), 'torch.chunk', 'torch.chunk', (['input'], {'chunks': '(3)', 'dim': '(-3)'}), '(input, chunks=3, dim=-3)\n', (1223, 1248), False, 'import torch\n'), ((1322, 1370), 'torch.clamp', 'torch.clamp', (['(s * saturation_factor)'], {'min': '(0)', 'max': '(1)'}), '(s * saturation_factor, min=0, max=1)\n', (1333, ...
rmccann01/playground
pommerman/__init__.py
354041cd1d9b70ffe82c18fb5b4035fab721eb92
'''Entry point into the pommerman module''' import gym import inspect from . import agents from . import configs from . import constants from . import forward_model from . import helpers from . import utility from . import network gym.logger.set_level(40) REGISTRY = None def _register(): global REGISTRY REGI...
[((232, 256), 'gym.logger.set_level', 'gym.logger.set_level', (['(40)'], {}), '(40)\n', (252, 256), False, 'import gym\n'), ((349, 396), 'inspect.getmembers', 'inspect.getmembers', (['configs', 'inspect.isfunction'], {}), '(configs, inspect.isfunction)\n', (367, 396), False, 'import inspect\n'), ((1014, 1033), 'gym.mak...
caravancoop/rest-auth-toolkit
demo/demo/accounts/urls.py
425bf293987f7128d9538f27a5eca7e47ba84217
from django.urls import path from .views import ProfileView urlpatterns = [ path('', ProfileView.as_view(), name='user-profile'), ]
[]
vardaan-raj/auto-sklearn
test/test_pipeline/components/classification/test_passive_aggressive.py
4597152e3a60cd6f6e32719a3bef26e13951b102
import sklearn.linear_model from autosklearn.pipeline.components.classification.passive_aggressive import \ PassiveAggressive from .test_base import BaseClassificationComponentTest class PassiveAggressiveComponentTest(BaseClassificationComponentTest): __test__ = True res = dict() res["default_iris...
[]
harsh020/datasets
tensorflow_datasets/structured/dart/dart_test.py
b4ad3617b279ec65356e696c4c860458621976f6
# coding=utf-8 # Copyright 2020 The TensorFlow Datasets Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
[((3123, 3147), 'tensorflow_datasets.public_api.testing.test_main', 'tfds.testing.test_main', ([], {}), '()\n', (3145, 3147), True, 'import tensorflow_datasets.public_api as tfds\n'), ((2806, 2817), 'tensorflow_datasets.structured.dart.dart.Dart', 'dart.Dart', ([], {}), '()\n', (2815, 2817), False, 'from tensorflow_dat...
AdamLohSg/GTA
exp/exp_informer_dad.py
bf6a745a6e28e365466e76360a15ca10ce61e009
from data.data_loader_dad import ( NASA_Anomaly, WADI ) from exp.exp_basic import Exp_Basic from models.model import Informer from utils.tools import EarlyStopping, adjust_learning_rate from utils.metrics import metric from sklearn.metrics import classification_report import numpy as np import torch import t...
[((438, 471), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (461, 471), False, 'import warnings\n'), ((2215, 2335), 'torch.utils.data.DataLoader', 'DataLoader', (['data_set'], {'batch_size': 'batch_size', 'shuffle': 'shuffle_flag', 'num_workers': 'args.num_workers', 'drop...
liangleslie/core
tests/components/mysensors/conftest.py
cc807b4d597daaaadc92df4a93c6e30da4f570c6
"""Provide common mysensors fixtures.""" from __future__ import annotations from collections.abc import AsyncGenerator, Callable, Generator import json from typing import Any from unittest.mock import AsyncMock, MagicMock, patch from mysensors import BaseSyncGateway from mysensors.persistence import MySensorsJSONDeco...
[((917, 945), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (931, 945), False, 'import pytest\n'), ((1148, 1175), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""mqtt"""'}), "(name='mqtt')\n", (1162, 1175), False, 'import pytest\n'), ((1312, 1349), 'pytest.fixture', 'pytest....
SymenYang/Vanish-Point-Detect
Detect.py
0e83e2b2a86e9523ed4a86f592f3a8dee594d691
import cv2 as cv import numpy as np import copy import math import Edges import INTPoint eps = 1e-7 votes = {} Groups = [] VPoints = [] Centers = [] Cluster = [] voters = {} def getEdges(image): #moved to Edges.py return Edges.getEdges(image) def getLines(edges): #moved to Edges.py return Edges.getLin...
[]
wanasit/labelling-notebook
test/test_files.py
c9e7f6895cd4672e3b5af603bdddf08246d35094
def test_list_example_directory(client): response = client.get("/api/files") assert response.status_code == 200 file_list = response.get_json() assert len(file_list) == 5 assert file_list[0]['key'] == 'image_annotated.jpg' assert file_list[1]['key'] == 'image.jpg' assert file_list[2]['key']...
[]
osoco/better-ways-of-thinking-about-software
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/course_groups/migrations/0001_initial.py
83e70d23c873509e22362a09a10d3510e10f6992
from django.db import migrations, models from django.conf import settings from opaque_keys.edx.django.models import CourseKeyField class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( ...
[((202, 259), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (233, 259), False, 'from django.db import migrations, models\n'), ((3807, 3907), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether',...
farkaskid/recipes
kafka-rockset-integration/generate_customers_data.py
8eef799cda899ea266f2849d485917f9b0d83190
"""Generate Customer Data""" import csv import random from config import MIN_CUSTOMER_ID, MAX_CUSTOMER_ID ACQUISITION_SOURCES = [ 'OrganicSearch', 'PaidSearch', 'Email', 'SocialMedia', 'Display', 'Affiliate' 'Referral' ] def main(): with open('customers.csv', 'w') as fout: w...
[((328, 396), 'csv.DictWriter', 'csv.DictWriter', (['fout'], {'fieldnames': "['CustomerID', 'AcquisitionSource']"}), "(fout, fieldnames=['CustomerID', 'AcquisitionSource'])\n", (342, 396), False, 'import csv\n'), ((606, 641), 'random.choices', 'random.choices', (['ACQUISITION_SOURCES'], {}), '(ACQUISITION_SOURCES)\n', ...
MatthewBM/parsl
parsl/tests/test_error_handling/test_resource_spec.py
f11417a0255ed290fd0d78ffa1bc52cfe7a06301
import parsl from parsl.app.app import python_app from parsl.tests.configs.local_threads import config from parsl.executors.errors import UnsupportedFeatureError from parsl.executors import WorkQueueExecutor @python_app def double(x, parsl_resource_specification={}): return x * 2 def test_resource(n=2): spe...
[((849, 873), 'parsl.load', 'parsl.load', (['local_config'], {}), '(local_config)\n', (859, 873), False, 'import parsl\n'), ((551, 562), 'parsl.dfk', 'parsl.dfk', ([], {}), '()\n', (560, 562), False, 'import parsl\n')]
cincanproject/cincan-command
cincan/file_tool.py
b8cde81931b1c8583ac7daa1327520fb9f06856e
import pathlib import re from typing import List, Optional, Dict, Set, Tuple, Iterable import shlex class FileMatcher: """Match files based on a pattern""" def __init__(self, match_string: str, include: bool): self.match_string = match_string self.exact = '*' not in match_string self.ab...
[((4455, 4473), 'pathlib.Path', 'pathlib.Path', (['path'], {}), '(path)\n', (4467, 4473), False, 'import pathlib\n'), ((6606, 6682), 'shlex.shlex', 'shlex.shlex', (['o_arg'], {'posix': '(True)', 'punctuation_chars': 'self.additional_punc_chars'}), '(o_arg, posix=True, punctuation_chars=self.additional_punc_chars)\n', (...
hubaimaster/aws-interface
aws_interface/cloud/auth/set_me.py
162dd056546d58b6eb29afcae1c3c2d78e4309b2
from cloud.permission import Permission, NeedPermission from cloud.message import error # Define the input output format of the function. # This information is used when creating the *SDK*. info = { 'input_format': { 'session_id': 'str', 'field': 'str', 'value?': 'str', }, 'output_...
[((410, 452), 'cloud.permission.NeedPermission', 'NeedPermission', (['Permission.Run.Auth.set_me'], {}), '(Permission.Run.Auth.set_me)\n', (424, 452), False, 'from cloud.permission import Permission, NeedPermission\n')]
celikten/armi
doc/gallery-src/analysis/run_blockMcnpMaterialCard.py
4e100dd514a59caa9c502bd5a0967fd77fdaf00e
""" Write MCNP Material Cards ========================= Here we load a test reactor and write each component of one fuel block out as MCNP material cards. Normally, code-specific utility code would belong in a code-specific ARMI plugin. But in this case, the need for MCNP materials cards is so pervasive that it made ...
[((562, 588), 'armi.configure', 'configure', ([], {'permissive': '(True)'}), '(permissive=True)\n', (571, 588), False, 'from armi import configure\n'), ((598, 629), 'armi.reactor.tests.test_reactors.loadTestReactor', 'test_reactors.loadTestReactor', ([], {}), '()\n', (627, 629), False, 'from armi.reactor.tests import t...
mustaqimM/life_line_chart
life_line_chart/_autogenerate_data.py
a9bbbbdeb5568aa0cc3b3b585337a3d655f4b2d6
import names import os import datetime from random import random def generate_gedcom_file(): """generate some gedcom file""" db = {} db['n_individuals'] = 0 db['max_individuals'] = 8000 db['n_families'] = 0 db['yougest'] = None gedcom_content = """ 0 HEAD 1 SOUR Gramps 2 VERS 3.3.0 2 N...
[((475, 496), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (494, 496), False, 'import datetime\n'), ((660, 723), 'names.get_first_name', 'names.get_first_name', ([], {'gender': "('male' if sex == 'M' else 'female')"}), "(gender='male' if sex == 'M' else 'female')\n", (680, 723), False, 'import names\...
LiorAvrahami/arcade
arcade/examples/sprite_bullets_enemy_aims.py
fce254a9eb89629de1f99d57a63759a2953184e9
""" Show how to have enemies shoot bullets aimed at the player. If Python and Arcade are installed, this example can be run from the command line with: python -m arcade.examples.sprite_bullets_enemy_aims """ import arcade import math import os SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 SCREEN_TITLE = "Sprites and Bullet...
[((4594, 4606), 'arcade.run', 'arcade.run', ([], {}), '()\n', (4604, 4606), False, 'import arcade\n'), ((876, 895), 'os.chdir', 'os.chdir', (['file_path'], {}), '(file_path)\n', (884, 895), False, 'import os\n'), ((905, 952), 'arcade.set_background_color', 'arcade.set_background_color', (['arcade.color.BLACK'], {}), '(...
FreakX23/EBook_Training
app1.py
de445b0a9e56a1f1ffc51ae3c5e10ebe8297e9b6
# This Part will gather Infos and demonstrate the use of Variables. usrName = input("What is your Name?") usrAge = int(input("What is your Age?")) usrGPA = float(input("What is your GPA?")) print () #cheap way to get a new line print ("Hello, %s" % (usrName)) print ("Did you know that in two years you will be %d years ...
[]
AmitHasanShuvo/Programming
borze.py
f47ecc626e518a0bf5f9f749afd15ce67bbe737b
a = input() a = a.replace('--', '2') a = a.replace('-.', '1') a = a.replace('.', '0') print(a)  
[]
charlesemurray/DistributedProgramming
distalg/message.py
f7b5001a6acb0583cd6b7bb611f27893b830c296
class Message: def __init__(self, from_channel=None, **kwargs): self._channel = from_channel if kwargs is not None: for key, value in kwargs.items(): setattr(self, key, value) @property def carrier(self): return self._channel def sender(self): ...
[]
rupeshparab/techscan
myenv/lib/python3.5/site-packages/tests/handlers/logging/logging_tests.py
ce2558602ddad31873d7129f25b1cc61895b9939
import logging from opbeat.handlers.logging import OpbeatHandler from opbeat.utils.stacks import iter_stack_frames from tests.helpers import get_tempstoreclient from tests.utils.compat import TestCase class LoggingIntegrationTest(TestCase): def setUp(self): self.client = get_tempstoreclient(include_paths...
[((287, 341), 'tests.helpers.get_tempstoreclient', 'get_tempstoreclient', ([], {'include_paths': "['tests', 'opbeat']"}), "(include_paths=['tests', 'opbeat'])\n", (306, 341), False, 'from tests.helpers import get_tempstoreclient\n'), ((365, 391), 'opbeat.handlers.logging.OpbeatHandler', 'OpbeatHandler', (['self.client'...
silenius/amnesia
amnesia/modules/mime/model.py
ba5e3ac79a89da599c22206ad1fd17541855f74c
# -*- coding: utf-8 -*- # pylint: disable=E1101 from sqlalchemy import sql from sqlalchemy import orm from sqlalchemy.orm.exc import NoResultFound from .. import Base # http://www.iana.org/assignments/media-types/media-types.xhtml class MimeMajor(Base): """Mime major""" def __init__(self, name): ...
[((722, 775), 'sqlalchemy.sql.and_', 'sql.and_', (['(MimeMajor.name == major)', '(Mime.name == minor)'], {}), '(MimeMajor.name == major, Mime.name == minor)\n', (730, 775), False, 'from sqlalchemy import sql\n'), ((1187, 1197), 'sqlalchemy.sql.and_', 'sql.and_', ([], {}), '()\n', (1195, 1197), False, 'from sqlalchemy i...
sunwei19910119/DjangoShop
apps/goods/views_base.py
188102dc8ef9f4751f4eeeb7574e95c8cc270484
# encoding: utf-8 from goods.models import Goods from django.views.generic.base import View class GoodsListView(View): def get(self, request): """ 通过django的view实现商品列表页 """ json_list = [] goods = Goods.objects.all()[:10] # for good in goods: # json_dict ...
[((986, 1022), 'django.core.serializers.serialize', 'serializers.serialize', (['"""json"""', 'goods'], {}), "('json', goods)\n", (1007, 1022), False, 'from django.core import serializers\n'), ((1043, 1064), 'json.loads', 'json.loads', (['json_data'], {}), '(json_data)\n', (1053, 1064), False, 'import json\n'), ((1376, ...
iyersathya/airlift
launcher/src/main/scripts/bin/launcher.py
27e981a50cee655ff4e1e13801ba5a55991f93ce
#!/usr/bin/env python import errno import os import platform import sys import traceback from fcntl import flock, LOCK_EX, LOCK_NB from optparse import OptionParser from os import O_RDWR, O_CREAT, O_WRONLY, O_APPEND from os.path import basename, dirname, exists, realpath from os.path import join as pathjoin from sign...
[((879, 889), 'os.path.dirname', 'dirname', (['p'], {}), '(p)\n', (886, 889), False, 'from os.path import basename, dirname, exists, realpath\n'), ((3408, 3435), 'os.open', 'os.open', (['os.devnull', 'O_RDWR'], {}), '(os.devnull, O_RDWR)\n', (3415, 3435), False, 'import os\n'), ((3476, 3488), 'os.close', 'os.close', ([...
vectorcrumb/Ballbot_IEE2913
code/sim/test.py
5ab54825b2bfadae251e2c6bfaaa7f8fcdae77a0
from direct.showbase.ShowBase import ShowBase from direct.task import Task from direct.actor.Actor import Actor import numpy as np class MyApp(ShowBase): def __init__(self): ShowBase.__init__(self) # Load environment model self.scene = self.loader.loadModel("models/environment") # ...
[((188, 211), 'direct.showbase.ShowBase.ShowBase.__init__', 'ShowBase.__init__', (['self'], {}), '(self)\n', (205, 211), False, 'from direct.showbase.ShowBase import ShowBase\n'), ((695, 754), 'direct.actor.Actor.Actor', 'Actor', (['"""models/panda-model"""', "{'walk': 'models/panda-walk4'}"], {}), "('models/panda-mode...
nationalarchives/tdr-service-unavailable
run_locally.py
fcb5930f57459b1e4e6d2d14244ebeecee2f6907
from app import app app.run()
[((22, 31), 'app.app.run', 'app.run', ([], {}), '()\n', (29, 31), False, 'from app import app\n')]
briangrahamww/pandas-profiling
src/pandas_profiling/model/describe.py
62f8e3fd81720d444041069191c4aacd03d79ad5
"""Organize the calculation of statistics for each series in this DataFrame.""" import warnings from datetime import datetime from typing import Optional import pandas as pd from tqdm.auto import tqdm from visions import VisionsTypeset from pandas_profiling.config import Settings from pandas_profiling.model.correlati...
[((1774, 1791), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (1789, 1791), False, 'from datetime import datetime\n'), ((5130, 5147), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (5145, 5147), False, 'from datetime import datetime\n'), ((1652, 1703), 'warnings.warn', 'warnings.war...
Ruanxingzhi/King-of-Pigeon
maxOfferNum.py
38d6191c93c2d485b2e5cf163f06b9f2a5dacbec
import operator class Std(object): def __init__(self): self.name = '' self.offerNum = 0 self.offers = [] stds = [] stdsDict = {} index = 0 def readStd(name,camper): global stds global stdsDict global index if name not in stdsDict: newStd = Std() newStd.name...
[((872, 911), 'operator.attrgetter', 'operator.attrgetter', (['"""offerNum"""', '"""name"""'], {}), "('offerNum', 'name')\n", (891, 911), False, 'import operator\n')]
MrMonk3y/vimrc
tabnine-vim/third_party/ycmd/third_party/python-future/setup.py
950230fb3fd7991d1234c2ab516ec03245945677
#!/usr/bin/env python from __future__ import absolute_import, print_function import os import os.path import sys try: from setuptools import setup except ImportError: from distutils.core import setup if sys.argv[-1] == 'publish': os.system('python setup.py sdist upload') sys.exit() NAME = "futur...
[((4843, 5381), 'distutils.core.setup', 'setup', ([], {'name': 'NAME', 'version': 'VERSION', 'author': 'AUTHOR', 'author_email': 'AUTHOR_EMAIL', 'url': 'URL', 'description': 'DESCRIPTION', 'long_description': 'LONG_DESC', 'license': 'LICENSE', 'keywords': 'KEYWORDS', 'entry_points': "{'console_scripts': ['futurize = li...
Andrelpoj/hire.me
url_shortener/src/__init__.py
79428e2094a6b56e762a7f958e1b75f395f59cef
from flask import Flask from .extensions import db from .routes import short from . import config def create_app(): """ Creates Flask App, connect to Database and register Blueprint of routes""" app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = config.DATABASE_CONNECTION_URI app.co...
[((217, 232), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (222, 232), False, 'from flask import Flask\n')]
wangchuanli001/Project-experience
python-百度翻译调用/Baidu_translate/com/translate/baidu/stackoverflow_question_handler.py
b563c5c3afc07c913c2e1fd25dff41c70533f8de
import requests from bs4 import BeautifulSoup import urllib.request import os import random import time def html(url): user_agents = [ 'Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11', 'Opera/9.25 (Windows NT 5.1; U; en)', 'Mozilla/4.0 (compatible...
[((923, 949), 'random.choice', 'random.choice', (['user_agents'], {}), '(user_agents)\n', (936, 949), False, 'import random\n'), ((1045, 1083), 'requests.get', 'requests.get', ([], {'url': 'url', 'headers': 'headers'}), '(url=url, headers=headers)\n', (1057, 1083), False, 'import requests\n'), ((1119, 1157), 'bs4.Beaut...
ALEXKIRNAS/Kaggle-C-CORE-Iceberg-Classifier-Challenge
Research/data_loader.py
d8b06969c9393cfce6d9ac96b58c9d365ff4369d
import os import numpy as np import pandas as pd from keras.utils import to_categorical from sklearn.model_selection import KFold, train_test_split def load_data(path): train = pd.read_json(os.path.join(path, "./train.json")) test = pd.read_json(os.path.join(path, "./test.json")) return (train, test) ...
[((1090, 1215), 'numpy.concatenate', 'np.concatenate', (['[X_band_1[:, :, :, (np.newaxis)], X_band_2[:, :, :, (np.newaxis)], angl[:,\n :, :, (np.newaxis)]]'], {'axis': '(-1)'}), '([X_band_1[:, :, :, (np.newaxis)], X_band_2[:, :, :, (np.\n newaxis)], angl[:, :, :, (np.newaxis)]], axis=-1)\n', (1104, 1215), True, '...
tiagopms/polyaxon-cli
polyaxon_cli/cli/experiment.py
eb13e3b8389ccf069a421a4dabc87aaa506ab61c
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import sys import click import rhea from polyaxon_cli.cli.getters.experiment import ( get_experiment_job_or_local, get_project_experiment_or_local ) from polyaxon_cli.cli.upload import upload from polyaxon_cli.client imp...
[((1936, 1949), 'click.group', 'click.group', ([], {}), '()\n', (1947, 1949), False, 'import click\n'), ((1951, 2053), 'click.option', 'click.option', (['"""--project"""', '"""-p"""'], {'type': 'str', 'help': '"""The project name, e.g. \'mnist\' or \'adam/mnist\'."""'}), '(\'--project\', \'-p\', type=str, help=\n "T...
Habbo3/Project-Euler
Problem_09.py
1a01d67f72b9cfb606d13df91af89159b588216e
""" A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a2 + b2 = c2 For example, 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. """ solved = False for a in range(1, 1000): for b in range(1, 1000): for c in range(...
[]
fanscribed/fanscribed
fanscribed/apps/transcripts/tests/test_transcripts.py
89b14496459f81a152df38ed5098fba2b087a1d7
from decimal import Decimal import os from django.test import TestCase from unipath import Path from ....utils import refresh from ...media import tests from ..models import Transcript, TranscriptMedia MEDIA_TESTDATA_PATH = Path(tests.__file__).parent.child('testdata') RAW_MEDIA_PATH = MEDIA_TESTDATA_PATH.child('r...
[((1922, 1949), 'os.environ.get', 'os.environ.get', (['"""FAST_TEST"""'], {}), "('FAST_TEST')\n", (1936, 1949), False, 'import os\n'), ((228, 248), 'unipath.Path', 'Path', (['tests.__file__'], {}), '(tests.__file__)\n', (232, 248), False, 'from unipath import Path\n'), ((825, 840), 'decimal.Decimal', 'Decimal', (['"""0...
BurcinSayin/pf2
buildAncestryFeats.py
bcd362dc0a750b8ee59cd19ecff9cf5be4f34b19
from bs4 import BeautifulSoup import requests import json import datetime import codecs import re featHolder = {} featHolder['name'] = 'Pathfinder 2.0 Ancestry feat list' featHolder['date'] = datetime.date.today().strftime("%B %d, %Y") def get_details(link): res = requests.get(link) res.raise_for_status() ...
[((2384, 2434), 'codecs.open', 'codecs.open', (['"""ancestryFeats.csv"""'], {'encoding': '"""utf-8"""'}), "('ancestryFeats.csv', encoding='utf-8')\n", (2395, 2434), False, 'import codecs\n'), ((2632, 2664), 'json.dumps', 'json.dumps', (['featHolder'], {'indent': '(4)'}), '(featHolder, indent=4)\n', (2642, 2664), False,...
Jahronimo/public_question_book_framework
Random_item_selector_module.py
812bd11b104de013e930536713b8134d046642d5
import random def Randomise(questions_lists): import random import secrets secure_random = secrets.SystemRandom()# creates a secure random object. group_of_items = questions_lists num_qustion_t_select = num_question_to_display list_of_random_item...
[((130, 152), 'secrets.SystemRandom', 'secrets.SystemRandom', ([], {}), '()\n', (150, 152), False, 'import secrets\n')]
jose-marquez89/tech-job-landscape
python_scrape/test_functions.py
0b509536e7ba22885f50c82da8cf990b65373090
import unittest import scrape class TestScrapeFunctions(unittest.TestCase): def test_build_url(self): url = scrape.build_url("indeed", "/jobs?q=Data+Scientist&l=Texas&start=10", join_next=True) expected = ("https://www.indeed.com/" ...
[((1212, 1227), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1225, 1227), False, 'import unittest\n'), ((123, 212), 'scrape.build_url', 'scrape.build_url', (['"""indeed"""', '"""/jobs?q=Data+Scientist&l=Texas&start=10"""'], {'join_next': '(True)'}), "('indeed', '/jobs?q=Data+Scientist&l=Texas&start=10',\n jo...
jaeheeLee17/BOJ_Algorithms
Level1_Input_Output/10172.py
c14641693d7ef0f5bba0a6637166c7ceadb2a0be
def main(): print("|\_/|") print("|q p| /}") print("( 0 )\"\"\"\\") print("|\"^\"` |") print("||_/=\\\\__|") if __name__ == "__main__": main()
[]
rupakc/Kaggle-Compendium
Whats Cooking/KaggleCookingComparison.py
61634ba742f9a0239f2d1e45973c4bb477ac6306
# -*- coding: utf-8 -*- """ Created on Sat Dec 26 13:20:45 2015 Code for Kaggle What's Cooking Competition It uses the following classifiers with tf-idf,hashvectors and bag_of_words approach 1. Adaboost 2. Extratrees 3. Bagging 4. Random Forests @author: Rupak Chakraborty """ import numpy as np import time import json...
[]
YanhaoXu/python-learning
pybook/ch10/DeckOfCards.py
856687a71635a2ca67dab49d396c238f128e5ec0
import random # Create a deck of cards deck = [x for x in range(52)] # Create suits and ranks lists suits = ["Spades", "Hearts", "Diamonds", "Clubs"] ranks = ["Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King"] # Shuffle the cards random.shuffle(deck) # Display the first four card...
[((269, 289), 'random.shuffle', 'random.shuffle', (['deck'], {}), '(deck)\n', (283, 289), False, 'import random\n')]
ojipadeson/NLPGNN
nlpgnn/gnn/RGCNConv.py
7c43d2f0cb2b16c046c930037fd505c5c4f36db4
#! usr/bin/env python3 # -*- coding:utf-8 -*- """ @Author:Kaiyin Zhou Usage: node_embeddings = tf.random.normal(shape=(5, 3)) adjacency_lists = [ tf.constant([[0, 1], [2, 4], [2, 4]], dtype=tf.int32), tf.constant([[0, 1], [2, 4], [2, 4]], dtype=tf.int32) ] layer...
[((938, 983), 'tensorflow.keras.initializers.get', 'tf.keras.initializers.get', (['kernel_initializer'], {}), '(kernel_initializer)\n', (963, 983), True, 'import tensorflow as tf\n'), ((1016, 1059), 'tensorflow.keras.initializers.get', 'tf.keras.initializers.get', (['bias_initializer'], {}), '(bias_initializer)\n', (10...
erikwebb/google-cloud-python
automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py
288a878e9a07239015c78a193eca1cc15e926127
# -*- coding: utf-8 -*- # # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
[((2057, 2110), 'pkg_resources.get_distribution', 'pkg_resources.get_distribution', (['"""google-cloud-automl"""'], {}), "('google-cloud-automl')\n", (2087, 2110), False, 'import pkg_resources\n'), ((3380, 3443), 'google.oauth2.service_account.Credentials.from_service_account_file', 'service_account.Credentials.from_se...
SHIVJITH/Odoo_Machine_Test
addons/project/models/project.py
310497a9872db7844b521e6dab5f7a9f61d365a4
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import ast from datetime import timedelta, datetime from random import randint from odoo import api, fields, models, tools, SUPERUSER_ID, _ from odoo.exceptions import UserError, AccessError, ValidationError, RedirectWa...
[((786, 824), 'odoo.fields.Boolean', 'fields.Boolean', (['"""Active"""'], {'default': '(True)'}), "('Active', default=True)\n", (800, 824), False, 'from odoo import api, fields, models, tools, SUPERUSER_ID, _\n'), ((836, 899), 'odoo.fields.Char', 'fields.Char', ([], {'string': '"""Stage Name"""', 'required': '(True)', ...
Maethorin/pivocram
app/config.py
f1709f5ee76d0280601efa87f3af8e89c2968f43
# -*- coding: utf-8 -*- """ Config File for enviroment variables """ import os from importlib import import_module class Config(object): """ Base class for all config variables """ DEBUG = False TESTING = False DEVELOPMENT = False CSRF_ENABLED = True SQLALCHEMY_DATABASE_URI = os.envi...
[]
hongyuanChrisLi/RealEstateDBConvert
initial_load.py
0fd04f5213ff3fd3548db3f322828bd80cf41791
from mysql_dao.select_dao import SelectDao as MysqlSelectDao from postgres_dao.ddl_dao import DdlDao from postgres_dao.dml_dao import DmlDao as PsqlDmlDao psql_ddl_dao = DdlDao() mysql_select_dao = MysqlSelectDao() psql_dml_dao = PsqlDmlDao() psql_ddl_dao.create_tables() county_data = mysql_select_dao.select_all_cou...
[((171, 179), 'postgres_dao.ddl_dao.DdlDao', 'DdlDao', ([], {}), '()\n', (177, 179), False, 'from postgres_dao.ddl_dao import DdlDao\n'), ((199, 215), 'mysql_dao.select_dao.SelectDao', 'MysqlSelectDao', ([], {}), '()\n', (213, 215), True, 'from mysql_dao.select_dao import SelectDao as MysqlSelectDao\n'), ((231, 243), '...
ramalingam-cb/testrunner
pytests/docs/docs.py
81cea7a5a493cf0c67fca7f97c667cd3c6ad2142
import time import logger from basetestcase import BaseTestCase from couchbase_helper.documentgenerator import DocumentGenerator from membase.api.rest_client import RestConnection from couchbase_helper.documentgenerator import BlobGenerator class DocsTests(BaseTestCase): def setUp(self): super(DocsTests, ...
[((683, 774), 'couchbase_helper.documentgenerator.DocumentGenerator', 'DocumentGenerator', (['"""test_docs"""', 'template', '[number]', 'first'], {'start': '(0)', 'end': 'self.num_items'}), "('test_docs', template, [number], first, start=0, end=self\n .num_items)\n", (700, 774), False, 'from couchbase_helper.documen...
truongaxin123/lichthidtu
lichthi.py
77ba75974769ab1fdd1281b6088a1734dc0a3a83
from bs4 import BeautifulSoup import requests from urllib.request import urlretrieve ROOT = 'http://pdaotao.duytan.edu.vn' def get_url_sub(sub, id_, page): all_td_tag = [] for i in range(1, page+1): print('http://pdaotao.duytan.edu.vn/EXAM_LIST/?page={}&lang=VN'.format(i)) r = requests.get('ht...
[((1004, 1021), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (1016, 1021), False, 'import requests\n'), ((1033, 1062), 'bs4.BeautifulSoup', 'BeautifulSoup', (['r.text', '"""lxml"""'], {}), "(r.text, 'lxml')\n", (1046, 1062), False, 'from bs4 import BeautifulSoup\n'), ((401, 430), 'bs4.BeautifulSoup', 'Beau...
isabella232/feedloader
appengine/uploader/main.py
c0417480804d406a83d1aedcb7e7d719058fdbfd
# coding=utf-8 # Copyright 2021 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
[((1246, 1267), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (1257, 1267), False, 'import flask\n'), ((1287, 1309), 'google.cloud.logging.Client', 'cloud_logging.Client', ([], {}), '()\n', (1307, 1309), True, 'from google.cloud import logging as cloud_logging\n'), ((3229, 3275), 'models.upload_task...
BadDevCode/lumberyard
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/transforms.py
3d688932f919dbf5821f0cb8a210ce24abe39e9e
""" Implement transformation on Numba IR """ from __future__ import absolute_import, print_function from collections import namedtuple, defaultdict import logging from numba.analysis import compute_cfg_from_blocks, find_top_level_loops from numba import ir, errors, ir_utils from numba.analysis import compute_use_def...
[((334, 361), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (351, 361), False, 'import logging\n'), ((3335, 3404), 'collections.namedtuple', 'namedtuple', (['"""loop_lift_info"""', '"""loop,inputs,outputs,callfrom,returnto"""'], {}), "('loop_lift_info', 'loop,inputs,outputs,callfrom,retu...
HabibMrad/MONAI
tests/test_masked_inference_wsi_dataset.py
1314701c15623422574b0153d746666dc6004454
import os import unittest from unittest import skipUnless import numpy as np from numpy.testing import assert_array_equal from parameterized import parameterized from monai.apps.pathology.datasets import MaskedInferenceWSIDataset from monai.apps.utils import download_url from monai.utils import optional_import from t...
[((366, 390), 'monai.utils.optional_import', 'optional_import', (['"""cucim"""'], {}), "('cucim')\n", (381, 390), False, 'from monai.utils import optional_import\n'), ((404, 432), 'monai.utils.optional_import', 'optional_import', (['"""openslide"""'], {}), "('openslide')\n", (419, 432), False, 'from monai.utils import ...
paulolimac/manga-py
manga_py/providers/doujins_com.py
3d180846750a4e770b5024eb8cd15629362875b1
from manga_py.provider import Provider from .helpers.std import Std class DoujinsCom(Provider, Std): img_selector = '#image-container img.doujin' def get_archive_name(self) -> str: return 'archive' def get_chapter_index(self) -> str: return '0' def get_main_content(self): re...
[]
awesome-archive/urh
src/urh/ui/delegates/CheckBoxDelegate.py
c8c3aabc9d637ca660d8c72c3d8372055e0f3ec7
from PyQt5.QtCore import QModelIndex, QAbstractItemModel, Qt, pyqtSlot from PyQt5.QtWidgets import QItemDelegate, QWidget, QStyleOptionViewItem, QCheckBox class CheckBoxDelegate(QItemDelegate): def __init__(self, parent=None): super().__init__(parent) self.enabled = True def createEditor(self...
[((898, 908), 'PyQt5.QtCore.pyqtSlot', 'pyqtSlot', ([], {}), '()\n', (906, 908), False, 'from PyQt5.QtCore import QModelIndex, QAbstractItemModel, Qt, pyqtSlot\n'), ((407, 424), 'PyQt5.QtWidgets.QCheckBox', 'QCheckBox', (['parent'], {}), '(parent)\n', (416, 424), False, 'from PyQt5.QtWidgets import QItemDelegate, QWidg...
acceleratedmaterials/AMDworkshop_demo
neural_network/backup_casestudy/denbigh/tf_RNN.py
e7c2b931e023fc00ff7494b8acb2181f5c75bc4e
# -*- coding: utf-8 -*- ''' Framework: Tensorflow Training samples: 1600 Validation samples: 400 RNN with 128 units Optimizer: Adam Epoch: 100 Loss: Cross Entropy Activation function: Relu for network and Soft-max for regression Regularization: Drop-out, keep_prob = 0.8 Accuracy of Validation set: 95% ''' from __future...
[((824, 861), 'tflearn.data_utils.pad_sequences', 'pad_sequences', (['X'], {'maxlen': '(5)', 'value': '(0.0)'}), '(X, maxlen=5, value=0.0)\n', (837, 861), False, 'from tflearn.data_utils import to_categorical, pad_sequences\n'), ((865, 885), 'tflearn.data_utils.to_categorical', 'to_categorical', (['Y', '(2)'], {}), '(Y...
Nocty-chan/cs224n-squad
code/tests/test_tile_tf.py
0c0b342621e038aba8e20ff411da13dfa173351d
import numpy as np import tensorflow as tf H = 2 N = 2 M = 3 BS = 10 def my_softmax(arr): max_elements = np.reshape(np.max(arr, axis = 2), (BS, N, 1)) arr = arr - max_elements exp_array = np.exp(arr) print (exp_array) sum_array = np.reshape(np.sum(exp_array, axis=2), (BS, N, 1)) return exp_arra...
[((201, 212), 'numpy.exp', 'np.exp', (['arr'], {}), '(arr)\n', (207, 212), True, 'import numpy as np\n'), ((1260, 1284), 'tensorflow.add', 'tf.add', (['logits', 'exp_mask'], {}), '(logits, exp_mask)\n', (1266, 1284), True, 'import tensorflow as tf\n'), ((1347, 1380), 'tensorflow.nn.softmax', 'tf.nn.softmax', (['masked_...
hamogu/specutils
specutils/tests/test_smoothing.py
b873f2ac9b3c207c9e670246d102f46a9606d6ed
import numpy as np import pytest from astropy import convolution from scipy.signal import medfilt import astropy.units as u from ..spectra.spectrum1d import Spectrum1D from ..tests.spectral_examples import simulated_spectra from ..manipulation.smoothing import (convolution_smooth, box_smooth, ...
[((2105, 2147), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""width"""', '[1, 2.3]'], {}), "('width', [1, 2.3])\n", (2128, 2147), False, 'import pytest\n'), ((2941, 2987), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""width"""', "[-1, 0, 'a']"], {}), "('width', [-1, 0, 'a'])\n", (2964, 2987)...
buulikduong/1d_sgl_solver
modules/interpolator.py
03ce0b362d45acbbd3bb35e7b604ba97982eea92
"""Module interpolating mathematical functions out of support points""" from scipy.interpolate import interp1d, lagrange, CubicSpline def interpolator(x_sup, y_sup, method): """Interpolates a mathematical function from a given set of points using either linear, polynomial or cubic spline for the interpol...
[((618, 655), 'scipy.interpolate.interp1d', 'interp1d', (['x_sup', 'y_sup'], {'kind': '"""linear"""'}), "(x_sup, y_sup, kind='linear')\n", (626, 655), False, 'from scipy.interpolate import interp1d, lagrange, CubicSpline\n'), ((730, 752), 'scipy.interpolate.lagrange', 'lagrange', (['x_sup', 'y_sup'], {}), '(x_sup, y_su...
chentaoz/frappe
frappe/patches/v13_0/remove_web_view.py
ee3c4943bf6177ad3b410cdb0d802af486751a65
import frappe def execute(): frappe.delete_doc_if_exists("DocType", "Web View") frappe.delete_doc_if_exists("DocType", "Web View Component") frappe.delete_doc_if_exists("DocType", "CSS Class")
[((31, 81), 'frappe.delete_doc_if_exists', 'frappe.delete_doc_if_exists', (['"""DocType"""', '"""Web View"""'], {}), "('DocType', 'Web View')\n", (58, 81), False, 'import frappe\n'), ((83, 143), 'frappe.delete_doc_if_exists', 'frappe.delete_doc_if_exists', (['"""DocType"""', '"""Web View Component"""'], {}), "('DocType...
cpratim/DSA-Research-Paper
games.py
ebb856ef62f8a04aa72380e39afdde958eed529a
import json import matplotlib.pyplot as plt from pprint import pprint import numpy as np from scipy.stats import linregress from util.stats import * with open('data/game_stats.json', 'r') as f: df = json.load(f) X, y = [], [] for match, stats in df.items(): home, away = stats['home'], stats['away'] if home['mp'] !...
[((654, 670), 'scipy.stats.linregress', 'linregress', (['X', 'y'], {}), '(X, y)\n', (664, 670), False, 'from scipy.stats import linregress\n'), ((737, 770), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Free Throw Attempts"""'], {}), "('Free Throw Attempts')\n", (747, 770), True, 'import matplotlib.pyplot as plt\n'),...
gycggd/leaf-classification
src/generate_data.py
b37dd4a6a262562c454038218c1472329e54128b
import os import numpy as np import pandas as pd import tensorflow as tf from keras.preprocessing.image import ImageDataGenerator from keras.preprocessing.image import img_to_array, load_img from keras.utils.np_utils import to_categorical from sklearn.model_selection import StratifiedShuffleSplit from sklearn.preproces...
[((419, 446), 'pandas.read_csv', 'pd.read_csv', (['"""../train.csv"""'], {}), "('../train.csv')\n", (430, 446), True, 'import pandas as pd\n'), ((706, 732), 'pandas.read_csv', 'pd.read_csv', (['"""../test.csv"""'], {}), "('../test.csv')\n", (717, 732), True, 'import pandas as pd\n'), ((920, 939), 'numpy.argmax', 'np.ar...
ErickSimoes/URI-Online-Judge
2650-construindo-muralhas.py
7e6f141db2647b1d0d69951b064bd95b0ce4ba1a
# -*- coding: utf-8 -*- n, w = map(int, input().split()) for _ in range(n): entrada = input() last_space = entrada.rfind(' ') if int(entrada[last_space:]) > w: print(entrada[:last_space])
[]
yarix/m2cgen
tests/assemblers/test_ensemble.py
f1aa01e4c70a6d1a8893e27bfbe3c36fcb1e8546
from sklearn import ensemble from m2cgen import assemblers, ast from tests import utils def test_single_condition(): estimator = ensemble.RandomForestRegressor(n_estimators=2, random_state=1) estimator.fit([[1], [2]], [1, 2]) assembler = assemblers.RandomForestModelAssembler(estimator) actual = ass...
[((136, 198), 'sklearn.ensemble.RandomForestRegressor', 'ensemble.RandomForestRegressor', ([], {'n_estimators': '(2)', 'random_state': '(1)'}), '(n_estimators=2, random_state=1)\n', (166, 198), False, 'from sklearn import ensemble\n'), ((255, 303), 'm2cgen.assemblers.RandomForestModelAssembler', 'assemblers.RandomFores...
Parquery/pynumenc
setup.py
f14abab40b7d08c55824bf1da5b2a7026c0a7282
"""A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ import os from setuptools import setup, find_packages, Extension import pynumenc_meta # pylint: disable=redefined-builtin here = os.path.abspath(os.path.dirname(__file__)) # ...
[((290, 315), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (305, 315), False, 'import os\n'), ((360, 392), 'os.path.join', 'os.path.join', (['here', '"""README.rst"""'], {}), "(here, 'README.rst')\n", (372, 392), False, 'import os\n'), ((1175, 1215), 'setuptools.find_packages', 'find_packag...
nipunjain099/AutoGuard
Models/License-Plate-Recognition-Nigerian-vehicles-master/License-Plate-Recognition-Nigerian-vehicles-master/ocr.py
8217cd03af7927590ef3a160ecb7d9bc9f50d101
import numpy as np from skimage.transform import resize from skimage import measure from skimage.measure import regionprops class OCROnObjects(): def __init__(self, license_plate): character_objects = self.identify_boundary_objects(license_plate) self.get_regions(character_objects, license_pla...
[((412, 442), 'skimage.measure.label', 'measure.label', (['a_license_plate'], {}), '(a_license_plate)\n', (425, 442), False, 'from skimage import measure\n'), ((692, 715), 'skimage.measure.regionprops', 'regionprops', (['labelImage'], {}), '(labelImage)\n', (703, 715), False, 'from skimage.measure import regionprops\n'...
mvlima/flask-jwt-auth
project/server/models.py
6cb210b50888b1e9a41ea9e63a80eafcbe436560
# project/server/models.py import jwt import datetime from project.server import app, db, bcrypt class User(db.Model): """ User Model for storing user related details """ __tablename__ = "users" id = db.Column(db.Integer, primary_key=True, autoincrement=True) username = db.Column(db.String(255), uni...
[((216, 275), 'project.server.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)', 'autoincrement': '(True)'}), '(db.Integer, primary_key=True, autoincrement=True)\n', (225, 275), False, 'from project.server import app, db, bcrypt\n'), ((533, 570), 'project.server.db.Column', 'db.Column', (['db.Integer']...
ccppuu/certbot
letsencrypt/setup.py
9fead41aaf93dde0d36d4aef6fded8dd306c1ddc
import codecs import os import sys from setuptools import setup from setuptools import find_packages def read_file(filename, encoding='utf8'): """Read unicode from given file.""" with codecs.open(filename, encoding=encoding) as fd: return fd.read() here = os.path.abspath(os.path.dirname(__file__)) ...
[((293, 318), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (308, 318), False, 'import os\n'), ((339, 371), 'os.path.join', 'os.path.join', (['here', '"""README.rst"""'], {}), "(here, 'README.rst')\n", (351, 371), False, 'import os\n'), ((195, 235), 'codecs.open', 'codecs.open', (['filename'...
dekhrekh/elastalert
elastalert/alerts.py
0c1ce30302c575bd0be404582cd452f38c01c774
# -*- coding: utf-8 -*- import copy import datetime import json import logging import subprocess import sys import warnings from email.mime.text import MIMEText from email.utils import formatdate from smtplib import SMTP from smtplib import SMTP_SSL from smtplib import SMTPAuthenticationError from smtplib import SMTPEx...
[]
DDC-NDRS/fledge-iot_fledge
tests/unit/python/fledge/services/core/scheduler/test_scheduler.py
27a5e66a55daaab1aca14ce6e66f9f1e6efaef51
# -*- coding: utf-8 -*- # FLEDGE_BEGIN # See: http://fledge-iot.readthedocs.io/ # FLEDGE_END import asyncio import datetime import uuid import time import json from unittest.mock import MagicMock, call import sys import copy import pytest from fledge.services.core.scheduler.scheduler import Scheduler, AuditLogger, C...
[((813, 842), 'pytest.allure.feature', 'pytest.allure.feature', (['"""unit"""'], {}), "('unit')\n", (834, 842), False, 'import pytest\n'), ((844, 876), 'pytest.allure.story', 'pytest.allure.story', (['"""scheduler"""'], {}), "('scheduler')\n", (863, 876), False, 'import pytest\n'), ((737, 748), 'unittest.mock.MagicMock...
kcc3/hackerrank-solutions
problem_solving/python/algorithms/greedy/marcs_cakewalk.py
f862b44b840bd447d99dc148f6bb5e2f5bfb8a86
def marcs_cakewalk(calorie): """Hackerrank Problem: https://www.hackerrank.com/challenges/marcs-cakewalk/problem Marc loves cupcakes, but he also likes to stay fit. Each cupcake has a calorie count, and Marc can walk a distance to expend those calories. If Marc has eaten j cupcakes so far, after eating a c...
[]
ankitgoswami23/CoronaIndiaTracker
coronaindiatracker/coronatracker/views.py
b2e116a595b3c69ccefa93b60833c09aa07b5eed
from django.shortcuts import render import requests from bs4 import BeautifulSoup def corona_data(request): "Testaaaa" corona_html = requests.get("https://www.mygov.in/covid-19") soup = BeautifulSoup(corona_html.content, 'html.parser') state_wise_data = soup.find_all('div', class_='views-row') inf...
[((143, 188), 'requests.get', 'requests.get', (['"""https://www.mygov.in/covid-19"""'], {}), "('https://www.mygov.in/covid-19')\n", (155, 188), False, 'import requests\n'), ((200, 249), 'bs4.BeautifulSoup', 'BeautifulSoup', (['corona_html.content', '"""html.parser"""'], {}), "(corona_html.content, 'html.parser')\n", (2...
geohackweek/ghw2019_wiggles
compare.py
9b636db8d97986e038a301e36b808e820ccc525f
# Script tests GPD model using UW truth data # Test outputs: # - type of event tested [EQS, EQP, SUS, SUP, THS, THP, SNS, SNP, PXS, PXP] # - phase [P, S, N] Note: N - not detected # - model time offset (t_truth - t_model_pick) import numpy import math import string import datetime import sys import os im...
[((433, 454), 'datetime.timedelta', 'timedelta', ([], {'seconds': '(27)'}), '(seconds=27)\n', (442, 454), False, 'from datetime import timedelta\n'), ((467, 488), 'datetime.timedelta', 'timedelta', ([], {'seconds': '(10)'}), '(seconds=10)\n', (476, 488), False, 'from datetime import timedelta\n'), ((1567, 1616), 'datet...
atheheath/ultitracker-api
ultitrackerapi/ultitrackerapi/extract_and_upload_video.py
5d7ea7ae97c53faf02416f17baf11ed09fd55276
import argparse import boto3 import datetime import json import os import posixpath import re import shutil import tempfile import uuid from concurrent import futures from multiprocessing import Pool from ultitrackerapi import get_backend, get_logger, get_s3Client, video backend_instance = get_backend() logger = ...
[((297, 310), 'ultitrackerapi.get_backend', 'get_backend', ([], {}), '()\n', (308, 310), False, 'from ultitrackerapi import get_backend, get_logger, get_s3Client, video\n'), ((320, 355), 'ultitrackerapi.get_logger', 'get_logger', (['__name__'], {'level': '"""DEBUG"""'}), "(__name__, level='DEBUG')\n", (330, 355), False...
PacktPublishing/Hands-On-Ensemble-Learning-with-Python
Chapter03/scikit_soft_voting_2knn.py
db9b90189dbebbc6ab5ebba0e2e173ba80197c35
# --- SECTION 1 --- # Import the required libraries from sklearn import datasets, naive_bayes, svm, neighbors from sklearn.ensemble import VotingClassifier from sklearn.metrics import accuracy_score # Load the dataset breast_cancer = datasets.load_breast_cancer() x, y = breast_cancer.data, breast_cancer.target ...
[((241, 270), 'sklearn.datasets.load_breast_cancer', 'datasets.load_breast_cancer', ([], {}), '()\n', (268, 270), False, 'from sklearn import datasets, naive_bayes, svm, neighbors\n'), ((569, 614), 'sklearn.neighbors.KNeighborsClassifier', 'neighbors.KNeighborsClassifier', ([], {'n_neighbors': '(5)'}), '(n_neighbors=5)...
kgarchie/ReSTful-Django-API
API/migrations/0005_alter_news_date_time_alter_news_headline.py
851c76eb75747042ceac0a6c164266409ca935d4
# Generated by Django 4.0.3 on 2022-03-23 14:31 import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('API', '0004_alter_news_date_time_alter_news_headline'), ] operations = [ migrations.AlterField( model_name='news...
[((572, 604), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (588, 604), False, 'from django.db import migrations, models\n'), ((400, 449), 'datetime.datetime', 'datetime.datetime', (['(2022)', '(3)', '(23)', '(17)', '(31)', '(17)', '(27766)'], {}), '(2022, 3, 23,...
stefan-woerner/aqua
qiskit/ml/datasets/iris.py
12e1b867e254977d9c5992612a7919d8fe016cb4
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2020. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
[((908, 943), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {'return_X_y': '(True)'}), '(return_X_y=True)\n', (926, 943), False, 'from sklearn import datasets\n'), ((1011, 1071), 'sklearn.model_selection.train_test_split', 'train_test_split', (['data', 'target'], {'test_size': '(1)', 'random_state': '(42)'})...
discodavey/h
tests/h/views/api_auth_test.py
7bff8478b3a5b936de82ac9fcd89b355f4afd3aa
# -*- coding: utf-8 -*- from __future__ import unicode_literals import datetime import json import mock import pytest from oauthlib.oauth2 import InvalidRequestFatalError from oauthlib.common import Request as OAuthRequest from pyramid import httpexceptions from h._compat import urlparse from h.exceptions import O...
[((685, 748), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""routes"""', '"""oauth_provider"""', '"""user_svc"""'], {}), "('routes', 'oauth_provider', 'user_svc')\n", (708, 748), False, 'import pytest\n'), ((9321, 9362), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""oauth_provider"""'], {}), ...
juslee/boost-svn
tools/build/v2/test/conditionals.py
6d5a03c1f5ed3e2b23bd0f3ad98d13ff33d4dcbb
#!/usr/bin/python # Copyright 2003 Dave Abrahams # Copyright 2002, 2003, 2004 Vladimir Prus # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) # Test conditional properties. import BoostBuild t = BoostBuild.Tester(...
[((302, 321), 'BoostBuild.Tester', 'BoostBuild.Tester', ([], {}), '()\n', (319, 321), False, 'import BoostBuild\n')]
FriendRat/pyo3
examples/setuptools-rust-starter/tests/test_setuptools_rust_starter.py
5446fe2062cb3bf11bf61bd4a2c58a7ed8b408d2
from setuptools_rust_starter import PythonClass, ExampleClass def test_python_class() -> None: py_class = PythonClass(value=10) assert py_class.value == 10 def test_example_class() -> None: example = ExampleClass(value=11) assert example.value == 11
[((112, 133), 'setuptools_rust_starter.PythonClass', 'PythonClass', ([], {'value': '(10)'}), '(value=10)\n', (123, 133), False, 'from setuptools_rust_starter import PythonClass, ExampleClass\n'), ((216, 238), 'setuptools_rust_starter.ExampleClass', 'ExampleClass', ([], {'value': '(11)'}), '(value=11)\n', (228, 238), Fa...
sunhailin-Leo/TeamLeoX_BlogsCrawler
spiders/juejin_spider.py
389ff31e02bdff415c8bc470a3a48da1acb14c4c
import time from typing import Dict, List, Tuple, Optional from utils.logger_utils import LogManager from utils.str_utils import check_is_json from config import LOG_LEVEL, PROCESS_STATUS_FAIL from utils.time_utils import datetime_str_change_fmt from utils.exception_utils import LoginException, ParseDataException from...
[((471, 491), 'utils.logger_utils.LogManager', 'LogManager', (['__name__'], {}), '(__name__)\n', (481, 491), False, 'from utils.logger_utils import LogManager\n'), ((1681, 1729), 'utils.str_utils.check_is_phone_number', 'check_is_phone_number', ([], {'data': 'self._login_username'}), '(data=self._login_username)\n', (1...
naviocean/SimpleCVReproduction
NAS/PaddleSlim/train_supernet.py
61b43e3583977f42e6f91ef176ec5e1701e98d33
from paddle.vision.transforms import ( ToTensor, RandomHorizontalFlip, RandomResizedCrop, SaturationTransform, Compose, HueTransform, BrightnessTransform, ContrastTransform, RandomCrop, Normalize, RandomRotation ) from paddle.vision.datasets import Cifar100 from paddle.io import DataLoader from paddle.optimizer...
[((2136, 2169), 'paddleslim.nas.ofa.DistillConfig', 'DistillConfig', ([], {'teacher_model': 'net2'}), '(teacher_model=net2)\n', (2149, 2169), False, 'from paddleslim.nas.ofa import OFA, RunConfig, DistillConfig\n'), ((2186, 2220), 'paddleslim.nas.ofa.convert_super.supernet', 'supernet', ([], {'channel': 'channel_option...
Myst1c-a/phen-cogs
slashtags/mixins/commands.py
672f9022ddbbd9a84b0a05357347e99e64a776fc
""" MIT License Copyright (c) 2020-present phenom4n4n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, pub...
[((1966, 2019), 're.compile', 're.compile', (['"""(?i)(\\\\[p\\\\])?\\\\b(slash\\\\s?)?tag\'?s?\\\\b"""'], {}), '("(?i)(\\\\[p\\\\])?\\\\b(slash\\\\s?)?tag\'?s?\\\\b")\n', (1976, 2019), False, 'import re\n'), ((2029, 2060), 're.compile', 're.compile', (['""".{1,100}:.{1,100}"""'], {}), "('.{1,100}:.{1,100}')\n", (2039,...