repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
Ipgnosis/tic_tac_toe | ttt_package/libs/best_move.py | e1519b702531965cc647ff37c1c46d72f4b3b24e | # refactored from make_play to simplify
# by Russell on 3/5/21
#from ttt_package.libs.move_utils import get_open_cells
from ttt_package.libs.compare import get_transposed_games, reorient_games
from ttt_package.libs.calc_game_bound import calc_game_bound
from ttt_package.libs.maxi_min import maximin
# find the best mo... | [((925, 957), 'ttt_package.libs.compare.get_transposed_games', 'get_transposed_games', (['this_board'], {}), '(this_board)\n', (945, 957), False, 'from ttt_package.libs.compare import get_transposed_games, reorient_games\n'), ((1217, 1264), 'ttt_package.libs.calc_game_bound.calc_game_bound', 'calc_game_bound', (["tgame... |
paser4se/bbxyard | yard/skills/66-python/cookbook/yvhai/demo/mt/raw_thread.py | d09bc6efb75618b2cef047bad9c8b835043446cb | #!/usr/bin/env python3
# python 线程测试
import _thread
import time
from yvhai.demo.base import YHDemo
def print_time(thread_name, interval, times):
for cnt in range(times):
time.sleep(interval)
print(" -- %s: %s" % (thread_name, time.ctime(time.time())))
class RawThreadDemo(YHDemo):
def __in... | [((187, 207), 'time.sleep', 'time.sleep', (['interval'], {}), '(interval)\n', (197, 207), False, 'import time\n'), ((447, 505), '_thread.start_new_thread', '_thread.start_new_thread', (['print_time', "('Thread-01', 1, 10)"], {}), "(print_time, ('Thread-01', 1, 10))\n", (471, 505), False, 'import _thread\n'), ((518, 575... |
praneethgb/rasa | rasa/utils/tensorflow/constants.py | 5bf227f165d0b041a367d2c0bbf712ebb6a54792 | # constants for configuration parameters of our tensorflow models
LABEL = "label"
IDS = "ids"
# LABEL_PAD_ID is used to pad multi-label training examples.
# It should be < 0 to avoid index out of bounds errors by tf.one_hot.
LABEL_PAD_ID = -1
HIDDEN_LAYERS_SIZES = "hidden_layers_sizes"
SHARE_HIDDEN_LAYERS = "share_hid... | [] |
GamesCreatorsClub/GCC-Rover | client/canyons-of-mars/maze.py | 25a69f62a1bb01fc421924ec39f180f50d6a640b |
#
# Copyright 2016-2019 Games Creators Club
#
# MIT License
#
import math
import pyroslib
import pyroslib.logging
import time
from pyroslib.logging import log, LOG_LEVEL_ALWAYS, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG
from rover import WheelOdos, WHEEL_NAMES
from rover import normaiseAngle, angleDiference
from challenge_uti... | [((352, 364), 'math.sqrt', 'math.sqrt', (['(2)'], {}), '(2)\n', (361, 364), False, 'import math\n'), ((29948, 29995), 'rover.RoverState', 'RoverState', (['None', 'None', 'None', 'radar', 'None', 'None'], {}), '(None, None, None, radar, None, None)\n', (29958, 29995), False, 'from rover import Radar, RoverState\n'), ((2... |
jean1042/monitoring | src/spaceone/monitoring/conf/proto_conf.py | 0585a1ea52ec13285eaca81cc5b19fa3f7a1fba4 | PROTO = {
'spaceone.monitoring.interface.grpc.v1.data_source': ['DataSource'],
'spaceone.monitoring.interface.grpc.v1.metric': ['Metric'],
'spaceone.monitoring.interface.grpc.v1.project_alert_config': ['ProjectAlertConfig'],
'spaceone.monitoring.interface.grpc.v1.escalation_policy': ['EscalationPolicy']... | [] |
PirosB3/django | tests/delete_regress/models.py | 9b729ddd8f2040722971ccfb3b12f7d8162633d1 | from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
class Award(models.Model):
name = models.CharField(max_length=25)
object_id = models.PositiveIntegerField()
content_type = model... | [((218, 249), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(25)'}), '(max_length=25)\n', (234, 249), False, 'from django.db import models\n'), ((266, 295), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {}), '()\n', (293, 295), False, 'from django.db import models... |
TheoSaify/Yolo-Detector | All_Program.py | f1ac387370982de323a4fc09109c57736b8ce8d6 | import cv2
from cv2 import *
import numpy as np
from matplotlib import pyplot as plt
###############################SIFT MATCH Function#################################
def SIFTMATCH(img1,img2):
# Initiate SIFT detector
sift = cv2.xfeatures2d.SIFT_create()
# find the keypoints and descri... | [((4277, 4295), 'cv2.getTickCount', 'cv2.getTickCount', ([], {}), '()\n', (4293, 4295), False, 'import cv2\n'), ((4792, 4818), 'cv2.imread', 'cv2.imread', (['"""Scene.jpg"""', '(0)'], {}), "('Scene.jpg', 0)\n", (4802, 4818), False, 'import cv2\n'), ((4869, 4894), 'cv2.imread', 'cv2.imread', (['"""img3.jpg"""', '(0)'], ... |
industrial-optimization-group/researchers-night | apps/UI_phone_mcdm.py | 68f2fcb8530032e157badda772a795e1f3bb2c4b | import dash
from dash.exceptions import PreventUpdate
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import dash_bootstrap_components as dbc
import dash_table
import plotly.express as ex
import plotly.graph_objects as go
import pandas as pd
imp... | [((345, 398), 'pandas.read_csv', 'pd.read_csv', (['"""./data/Phone_dataset_new.csv"""'], {'header': '(0)'}), "('./data/Phone_dataset_new.csv', header=0)\n", (356, 398), True, 'import pandas as pd\n'), ((409, 458), 'pandas.read_csv', 'pd.read_csv', (['"""./data/Phone_details.csv"""'], {'header': '(0)'}), "('./data/Phone... |
k-j-m/Pyxon | pyxon/utils.py | a7f9b3ce524f2441e952c47acd199dd4024d2322 | import pyxon.decode as pd
def unobjectify(obj):
"""
Turns a python object (must be a class instance)
into the corresponding JSON data.
Example:
>>> @sprop.a # sprop annotations are needed to tell the
>>> @sprop.b # unobjectify function what parameter need
>>> @sprop.c # to be written out.... | [((910, 941), 'pyxon.decode.add_type_property', 'pd.add_type_property', (['data', 'cls'], {}), '(data, cls)\n', (930, 941), True, 'import pyxon.decode as pd\n'), ((1161, 1189), 'pyxon.decode.class_sprops.get', 'pd.class_sprops.get', (['cls', '{}'], {}), '(cls, {})\n', (1180, 1189), True, 'import pyxon.decode as pd\n'),... |
sophie685/newfileplzworklord | AxonDeepSeg/segment.py | fbbb03c44dc9e4b0409364b49265f453ac80d3c0 | # Segmentation script
# -------------------
# This script lets the user segment automatically one or many images based on the default segmentation models: SEM or
# TEM.
#
# Maxime Wabartha - 2017-08-30
# Imports
import sys
from pathlib import Path
import json
import argparse
from argparse import RawTextHelpFormatter... | [((652, 708), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['"""AxonDeepSeg"""', '"""models"""'], {}), "('AxonDeepSeg', 'models')\n", (683, 708), False, 'import pkg_resources\n'), ((723, 740), 'pathlib.Path', 'Path', (['MODELS_PATH'], {}), '(MODELS_PATH)\n', (727, 740), False, 'from pathlib im... |
aplested/DC_Pyps | tests/test_hedges.py | da33fc7d0e7365044e368488d1c7cbbae7473cc7 | from dcstats.hedges import Hedges_d
from dcstats.statistics_EJ import simple_stats as mean_SD
import random
import math
def generate_sample (length, mean, sigma):
#generate a list of normal distributed samples
sample = []
for n in range(length):
sample.append(random.gauss(mean, sigma))
return ... | [((551, 573), 'math.sqrt', 'math.sqrt', (['sample_size'], {}), '(sample_size)\n', (560, 573), False, 'import math\n'), ((723, 739), 'dcstats.hedges.Hedges_d', 'Hedges_d', (['s1', 's2'], {}), '(s1, s2)\n', (731, 739), False, 'from dcstats.hedges import Hedges_d\n'), ((373, 389), 'math.fabs', 'math.fabs', (['(a - b)'], {... |
MustafaAbbas110/FinalProject | src/FYP/fifaRecords/urls.py | 30d371f06a8a1875285cfd4a8940ca3610ec1274 | from django.urls import path
from . import views
urlpatterns = [
path('', views.Records, name ="fRec"),
] | [((70, 106), 'django.urls.path', 'path', (['""""""', 'views.Records'], {'name': '"""fRec"""'}), "('', views.Records, name='fRec')\n", (74, 106), False, 'from django.urls import path\n')] |
KennethEnevoldsen/spacy-transformers | spacy_transformers/tests/regression/test_spacy_issue6401.py | fa39a94ba276ae3681d14a4b376ea50fadd574b3 | import pytest
from spacy.training.example import Example
from spacy.util import make_tempdir
from spacy import util
from thinc.api import Config
TRAIN_DATA = [
("I'm so happy.", {"cats": {"POSITIVE": 1.0, "NEGATIVE": 0.0}}),
("I'm so angry", {"cats": {"POSITIVE": 0.0, "NEGATIVE": 1.0}}),
]
cfg_string = """
... | [((1181, 1252), 'spacy.util.load_model_from_config', 'util.load_model_from_config', (['orig_config'], {'auto_fill': '(True)', 'validate': '(True)'}), '(orig_config, auto_fill=True, validate=True)\n', (1208, 1252), False, 'from spacy import util\n'), ((1754, 1768), 'spacy.util.make_tempdir', 'make_tempdir', ([], {}), '(... |
rpacholek/hydra | hydra/client/repl.py | 60e3c2eec5ab1fd1dde8e510baa5175173c66a6a | import asyncio
from ..core.common.io import input
from .action_creator import ActionCreator
class REPL:
def __init__(self, action_queue, config, *args, **kwargs):
self.action_queue = action_queue
self.config = config
async def run(self):
await asyncio.sleep(1)
print("Insert c... | [((280, 296), 'asyncio.sleep', 'asyncio.sleep', (['(1)'], {}), '(1)\n', (293, 296), False, 'import asyncio\n'), ((495, 514), 'asyncio.all_tasks', 'asyncio.all_tasks', ([], {}), '()\n', (512, 514), False, 'import asyncio\n')] |
drat/Neural-Voice-Cloning-With-Few-Samples | train_dv3.py | 4febde43ccc143fc88d74d5fa0c5a117636778b4 | """Trainining script for seq2seq text-to-speech synthesis model.
usage: train.py [options]
options:
--data-root=<dir> Directory contains preprocessed features.
--checkpoint-dir=<dir> Directory where to save model checkpoints [default: checkpoints].
--hparams=<parmas> Hyper param... | [((2046, 2071), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (2069, 2071), False, 'import torch\n'), ((18998, 19016), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (19001, 19016), False, 'from numba import jit\n'), ((2538, 2552), 'matplotlib.pyplot.subplots', 'plt.sub... |
alcinnz/Historical-Twin | magic_mirror.py | 54a9ab5dc130aaeb2e00058bbaeace7377e2ff3d | #! /usr/bin/python2
import time
start = time.time()
import pygame, numpy
import pygame.camera
# Init display
screen = pygame.display.set_mode((0,0), pygame.FULLSCREEN)
pygame.display.set_caption("Magic Mirror")
#pygame.mouse.set_visible(False)
# Init font
pygame.font.init()
font_colour = 16, 117, 186
fonts = {40: p... | [] |
plojyon/resolwe | resolwe/__init__.py | 1bee6f0860fdd087534adf1680e9350d79ab97cf | """.. Ignore pydocstyle D400.
=======
Resolwe
=======
Open source enterprise dataflow engine in Django.
"""
from resolwe.__about__ import ( # noqa: F401
__author__,
__copyright__,
__email__,
__license__,
__summary__,
__title__,
__url__,
__version__,
)
| [] |
andremsouza/swine_sound_analysis | audio_som64_u_grupo1.py | 5583bf91b18e8ad2dcaccb30a94c134e2eab34a5 | # %% [markdown]
# # Testing python-som with audio dataset
# %% [markdown]
# # Imports
# %%
import matplotlib.pyplot as plt
# import librosa as lr
# import librosa.display as lrdisp
import numpy as np
import pandas as pd
import pickle
import seaborn as sns
import sklearn.preprocessing
from python_som import SOM
FILE... | [((395, 455), 'pandas.read_csv', 'pd.read_csv', (['"""features_means.csv"""'], {'index_col': '(0)', 'verbose': '(True)'}), "('features_means.csv', index_col=0, verbose=True)\n", (406, 455), True, 'import pandas as pd\n'), ((467, 491), 'pandas.to_datetime', 'pd.to_datetime', (['df.index'], {}), '(df.index)\n', (481, 491... |
dallinb/footy | footy/engine/UpdateEngine.py | d6879481a85b4a84023805bf29bd7dff32afa67f | """Prediction Engine - Update the data model with the most resent fixtures and results."""
from footy.domain import Competition
class UpdateEngine:
"""Prediction Engine - Update the data model with the most resent fixtures and results."""
def __init__(self):
"""Construct a UpdateEngine object."""
... | [] |
marsupialmarcos/deck.gl | bindings/pydeck/docs/scripts/embed_examples.py | c9867c1db87e492253865353f68c985019c7c613 | """Script to embed pydeck examples into .rst pages with code
These populate the files you see once you click into a grid cell
on the pydeck gallery page
"""
from multiprocessing import Pool
import os
import subprocess
import sys
from const import DECKGL_URL_BASE, EXAMPLE_GLOB, GALLERY_DIR, HTML_DIR, HOSTED_STATIC_PAT... | [((428, 460), 'os.environ.get', 'os.environ.get', (['"""MAPBOX_API_KEY"""'], {}), "('MAPBOX_API_KEY')\n", (442, 460), False, 'import os\n'), ((638, 694), 'utils.to_snake_case_string', 'to_snake_case_string', ([], {'file_name': 'pydeck_example_file_name'}), '(file_name=pydeck_example_file_name)\n', (658, 694), False, 'f... |
mharding01/augmented-neuromuscular-RT-running | symbolicR/python/forward_kin.py | 7e1ef00d3fdf9cfa9d59fc4f3a6a0e6dd792a834 | import numpy as np
import sympy as sp
import re
import os
######################
# #
# 17 16 21 #
# 18 15 22 #
# 19 14 23 #
# 20 01 24 #
# 02 08 #
# 03 09 #
# 04 10 #
# 05 11 #
# 06 12 #
# 07... | [((40420, 40506), 'numpy.array', 'np.array', (['[0, 2, 1, 3, 2, 1, 2, 2, 1, 3, 2, 1, 2, 1, 2, 3, 2, 1, 3, 2, 2, 1, 3, 2]'], {}), '([0, 2, 1, 3, 2, 1, 2, 2, 1, 3, 2, 1, 2, 1, 2, 3, 2, 1, 3, 2, 2, 1,\n 3, 2])\n', (40428, 40506), True, 'import numpy as np\n'), ((40648, 40748), 'numpy.array', 'np.array', (['[-1, 0, 1, 2... |
0xiso/PyMISP | examples/last.py | 20a340414422714dcf31389957343c663550ed1a | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import misp_url, misp_key, misp_verifycert
import argparse
import os
import json
# Usage for pipe masters: ./last.py -l 5h | jq .
def init(url, key):
return PyMISP(url, key, misp_verifycert, 'json')
def download_last(m, last, o... | [((248, 289), 'pymisp.PyMISP', 'PyMISP', (['url', 'key', 'misp_verifycert', '"""json"""'], {}), "(url, key, misp_verifycert, 'json')\n", (254, 289), False, 'from pymisp import PyMISP\n'), ((692, 780), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Download latest events from a MISP insta... |
Chaoslecion123/Diver | saleor/dashboard/urls.py | 8c5c493701422eada49cbf95b0b0add08f1ea561 | from django.conf.urls import include, url
from django.views.generic.base import TemplateView
from . import views as core_views
from .category.urls import urlpatterns as category_urls
from .collection.urls import urlpatterns as collection_urls
from .customer.urls import urlpatterns as customer_urls
from .discount.urls ... | [((1630, 1671), 'django.conf.urls.url', 'url', (['"""^$"""', 'core_views.index'], {'name': '"""index"""'}), "('^$', core_views.index, name='index')\n", (1633, 1671), False, 'from django.conf.urls import include, url\n'), ((2295, 2357), 'django.conf.urls.url', 'url', (['"""^style-guide/"""', 'core_views.styleguide'], {'... |
Jf-Chen/FRN-main | experiments/CUB_fewshot_raw/FRN/ResNet-12/train.py | 5b57b9e0d7368058a8e3ba41a53c460b54ab9b91 | import os
import sys
import torch
import yaml
from functools import partial
sys.path.append('../../../../')
from trainers import trainer, frn_train
from datasets import dataloaders
from models.FRN import FRN
args = trainer.train_parser()
with open('../../../../config.yml', 'r') as f:
temp = yaml.safe_load(f)
data... | [((76, 107), 'sys.path.append', 'sys.path.append', (['"""../../../../"""'], {}), "('../../../../')\n", (91, 107), False, 'import sys\n'), ((217, 239), 'trainers.trainer.train_parser', 'trainer.train_parser', ([], {}), '()\n', (237, 239), False, 'from trainers import trainer, frn_train\n'), ((328, 362), 'os.path.abspath... |
zzzace2000/dropout-feature-rankin | exp/DFRdatasets/simulate.py | 7769ce822f3c0a6d23167d11f1569f59e56b1266 | import argparse
import argparse
import os
import numpy as np
import torch
from dataloaders.LoaderBase import LoaderBase
import exp.feature.feature_utils as feature_utils
def run_with_identifier(unit, corr_val, datasize, rank_names, loader, show_ols=True):
loader.clear_cache()
# Ex: 'nn_rank:0.01'. Then ext... | [((1550, 1680), 'dataloaders.LoaderBase.LoaderBase.create', 'LoaderBase.create', (['args.dataset', "{'visdom_enabled': args.visdom_enabled, 'cuda_enabled': args.cuda,\n 'nn_cache': args.nn_cache}"], {}), "(args.dataset, {'visdom_enabled': args.visdom_enabled,\n 'cuda_enabled': args.cuda, 'nn_cache': args.nn_cache... |
JiangZehua/gym-pcgrl | gym_pcgrl/envs/reps/wide_3D_rep.py | 80ddbde173803e81060578c2c4167d8d1f5cacba | from gym_pcgrl.envs.reps.representation3D import Representation3D
from PIL import Image
from gym import spaces
import numpy as np
from gym_pcgrl.envs.probs.minecraft.mc_render import reps_3D_render
"""
The wide representation where the agent can pick the tile position and tile value at each update.
"""
class Wide3DRep... | [((994, 1050), 'gym.spaces.MultiDiscrete', 'spaces.MultiDiscrete', (['[length, width, height, num_tiles]'], {}), '([length, width, height, num_tiles])\n', (1014, 1050), False, 'from gym import spaces\n'), ((1541, 1629), 'gym.spaces.Box', 'spaces.Box', ([], {'low': '(0)', 'high': '(num_tiles - 1)', 'dtype': 'np.uint8', ... |
thinkitdata/ucsmsdk | ucsmsdk/mometa/adaptor/AdaptorMenloQStats.py | da6599e1dbc1207a30eabe548a7e5791af5f476b | """This module contains the general information for AdaptorMenloQStats ManagedObject."""
from ...ucsmo import ManagedObject
from ...ucscoremeta import MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class AdaptorMenloQStatsConsts:
MENLO_QUEUE_COMPONENT_N = "N"
MENLO_QUEUE_COMPONENT_CPU = "cpu"
... | [] |
XelaRellum/old_password | python/old_password_test.py | b461941069bc7f1187776a992f86c89317ab215e | import unittest
import pytest
from old_password import old_password
import csv
import re
@pytest.mark.parametrize("password,expected_hash", [
(None, None),
("", ""),
("a", "60671c896665c3fa"),
("abc", "7cd2b5942be28759"),
("ä", "0751368d49315f7f"),
])
def test_old_password(password, expected_hash... | [((93, 259), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""password,expected_hash"""', "[(None, None), ('', ''), ('a', '60671c896665c3fa'), ('abc',\n '7cd2b5942be28759'), ('ä', '0751368d49315f7f')]"], {}), "('password,expected_hash', [(None, None), ('', ''),\n ('a', '60671c896665c3fa'), ('abc', '7cd... |
CindyChen1995/MKR | src/RS_model/train_mlp.py | f9ae37903dcf43b6d101dfc08644ce4a29ecbf9d | # -*- coding: utf-8 -*-
"""
-------------------------------------------------
Description :
Author : cmy
date: 2020/1/2
-------------------------------------------------
"""
import datetime
import heapq
import numpy as np
import tensorflow as tf
import time
from metrics import ndcg_at_k
from tr... | [((429, 445), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (443, 445), True, 'import tensorflow as tf\n'), ((766, 791), 'DMF.DMF', 'DMF', (['args', 'n_user', 'n_item'], {}), '(args, n_user, n_item)\n', (769, 791), False, 'from DMF import DMF\n'), ((870, 903), 'train.get_user_record', 'get_user_record',... |
glass-w/PyLipID | pylipid.py | ee29f92ba6187cd22b9554a599177152ebed9c4c | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 28 19:28:17 2019
@author: Wanling Song
"""
import mdtraj as md
import numpy as np
import pandas as pd
import argparse
import sys
from collections import defaultdict
import pickle
import os
import matplotlib
matplotlib.use('Agg')
import matplotlib.p... | [((279, 300), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (293, 300), False, 'import matplotlib\n'), ((724, 786), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (745, 786), False, '... |
yaakiyu/rt-bot | main.py | f68bca95c516e08c31ecc846524dcea4c8ba1503 | # RT by Rext
from asyncio import run
from discord import Intents, Status, Game, AllowedMentions
from core.bot import RT
from data import SECRET
try: from uvloop import install
except ModuleNotFoundError: ...
else: install()
intents = Intents.default()
intents.message_content = True
intents.members = True
bot = RT... | [((240, 257), 'discord.Intents.default', 'Intents.default', ([], {}), '()\n', (255, 257), False, 'from discord import Intents, Status, Game, AllowedMentions\n'), ((218, 227), 'uvloop.install', 'install', ([], {}), '()\n', (225, 227), False, 'from uvloop import install\n'), ((343, 374), 'discord.AllowedMentions', 'Allow... |
dmitryvinn/hiplot | hiplot/fetchers_demo.py | 52fe8b195a4e254240eb1a0847953fa3c1957a43 | # Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import uuid
import random
import math
import time
import typing as t
from . import experiment as hip
# Demos from the README. If one of those ... | [((2618, 2633), 'random.random', 'random.random', ([], {}), '()\n', (2631, 2633), False, 'import random\n'), ((1848, 1883), 'random.choice', 'random.choice', (['exp.datapoints[-10:]'], {}), '(exp.datapoints[-10:])\n', (1861, 1883), False, 'import random\n'), ((2749, 2770), 'random.uniform', 'random.uniform', (['(0)', '... |
brauls/ingredients-service | app/endpoints/common/dtos/ingredient.py | 67c1408f96f4b407d7e7b3e5e62406a6931de1c1 | """Ingredient dto.
"""
class Ingredient():
"""Class to represent an ingredient.
"""
def __init__(self, name, availability_per_month):
self.name = name
self.availability_per_month = availability_per_month
def __repr__(self):
return """{} is the name.""".format(self.name)
| [] |
kallangerard/grocery-barcode-scanner | barcode.py | 0a866c5b20c43355b642c0b78ba09d5cf4b0383c | import logging
import groceries.api as groceries
import barcodescanner.scan as barcode
def main():
grocy = groceries.GrocyAPIClient()
while True:
scanner = barcode.Scan()
line = scanner.PollScanner()
if line != None:
response = grocy.consume_barcode(line)
loggin... | [((113, 139), 'groceries.api.GrocyAPIClient', 'groceries.GrocyAPIClient', ([], {}), '()\n', (137, 139), True, 'import groceries.api as groceries\n'), ((371, 411), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (390, 411), False, 'import logging\n'), ((174, 188... |
mr-sk/easy-icm-runner | setup.py | 01cf9d7d8e4ef13afc18dbdda2862035121f3624 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="easy-icm-runner",
version="1.0.6",
author="Bachir El Koussa",
author_email="bgkoussa@gmail.com",
description="A wrapper for IBM ICMs Scheduler API Calls",
long_description=long_descrip... | [((88, 634), 'setuptools.setup', 'setuptools.setup', ([], {'name': '"""easy-icm-runner"""', 'version': '"""1.0.6"""', 'author': '"""Bachir El Koussa"""', 'author_email': '"""bgkoussa@gmail.com"""', 'description': '"""A wrapper for IBM ICMs Scheduler API Calls"""', 'long_description': 'long_description', 'long_descripti... |
zee93/molecule_parser | test_molecule.py | 42f5a3722d733ef9f7243bfa2b0b9a08c7bc5d23 | import unittest
from molecule import onize_formula, update_equation_with_multiplier, flaten_formula, parse_molecule
class MoleculeParserTestCases(unittest.TestCase):
def test_onizing_formulas(self):
self.assertEqual(onize_formula('H'), 'H1')
self.assertEqual(onize_formula('H2O'), 'H2O1')
... | [((1768, 1783), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1781, 1783), False, 'import unittest\n'), ((1034, 1055), 'molecule.parse_molecule', 'parse_molecule', (['"""H2O"""'], {}), "('H2O')\n", (1048, 1055), False, 'from molecule import onize_formula, update_equation_with_multiplier, flaten_formula, parse_mo... |
lyth031/ptb_lm | config.py | 71f687fdf41c6b981a306269c1341ea8a8347bb6 | # -*- coding: utf-8 -*-
class Config(object):
def __init__(self):
self.init_scale = 0.1
self.learning_rate = 1.0
self.max_grad_norm = 5
self.num_layers = 2
self.slice_size = 30
self.hidden_size = 200
self.max_epoch = 13
self.keep_prob = 0.8
se... | [] |
HupuInc/node-mysql-listener | binding.gyp | d23e55910acd1559d8339f36b1549f21aee8adaa | {
'targets': [
{
# have to specify 'liblib' here since gyp will remove the first one :\
'target_name': 'mysql_bindings',
'sources': [
'src/mysql_bindings.cc',
'src/mysql_bindings_connection.cc',
'src/mysql_bindings_result.cc',
'src/mysql_bindings_statement.cc',
... | [] |
GlenWalker/pymel | pymel/__init__.py | 8b69b72e1bb726a66792707af39626a987bf5c21 |
# copyright Chad Dombrova chadd@luma-pictures.com
# created at luma pictures www.luma-pictures.com
"""
*******************************
PyMEL
*******************************
PyMEL makes python scripting in Maya work the way it should. Maya's command module is a direct
translation of MEL commands into p... | [] |
rlbellaire/ActT | setup.py | b6e936e5037c5f92ad1c281e2bf3700bf91aea42 | from setuptools import find_packages, setup
setup(name='ActT',
version='0.6',
description='Active Testing',
url='',
author='',
author_email='none',
license='BSD',
packages=find_packages(),
install_requires=[
'numpy', 'pandas', 'matplotlib','scipy','scikit-learn',... | [((215, 230), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (228, 230), False, 'from setuptools import find_packages, setup\n')] |
coylen/pySG | Fusion/deltat.py | 6af1b8387c256f8898e2198c635c8e4b72ec3942 | # deltat.py time difference calculation for sensor fusion
# Released under the MIT License (MIT)
# Copyright (c) 2018 Peter Hinch
# Provides TimeDiff function and DeltaT class.
# The following notes cover special cases. Where the device performing fusion
# is linked to the IMU and is running MicroPython no special tre... | [((2672, 2687), 'time.ticks_us', 'time.ticks_us', ([], {}), '()\n', (2685, 2687), False, 'import time\n'), ((2208, 2235), 'time.ticks_diff', 'time.ticks_diff', (['start', 'end'], {}), '(start, end)\n', (2223, 2235), False, 'import time\n')] |
wenh06/colour | colour/models/rgb/datasets/sony.py | 445fdad2711ae39c95b4375166905568d24a95f4 | # -*- coding: utf-8 -*-
"""
Sony Colourspaces
=================
Defines the *Sony* colourspaces:
- :attr:`colour.models.RGB_COLOURSPACE_S_GAMUT`.
- :attr:`colour.models.RGB_COLOURSPACE_S_GAMUT3`.
- :attr:`colour.models.RGB_COLOURSPACE_S_GAMUT3_CINE`.
- :attr:`colour.models.RGB_COLOURSPACE_VENICE_S_GAMUT3`.
- ... | [((3812, 3865), 'numpy.array', 'np.array', (['[[0.73, 0.28], [0.14, 0.855], [0.1, -0.05]]'], {}), '([[0.73, 0.28], [0.14, 0.855], [0.1, -0.05]])\n', (3820, 3865), True, 'import numpy as np\n'), ((4325, 4473), 'numpy.array', 'np.array', (['[[0.7064827132, 0.1288010498, 0.1151721641], [0.2709796708, 0.7866064112, -\n ... |
QiaoZhongzheng/EWC-sample-PMNIST | network.py | cd5e10b401582ab7f0dcd7a1e38aed6552192484 | # -*- coding: UTF-8 -*-
'''=================================================
@Project -> File :EWC -> network
@IDE :PyCharm
@Author :Qiao Zhongzheng
@Date :2021/6/23 20:28
@Desc :
=================================================='''
from tensorflow.keras import Model
from tensorflow.keras.layers import Dense,... | [((387, 434), 'tensorflow.keras.layers.Input', 'Input', ([], {'shape': '(784)', 'dtype': '"""float32"""', 'name': '"""input"""'}), "(shape=784, dtype='float32', name='input')\n", (392, 434), False, 'from tensorflow.keras.layers import Dense, Conv2D, LeakyReLU, MaxPool2D, Flatten, Input\n'), ((703, 723), 'tensorflow.ker... |
Qfabiolous/QuanGuru | src/quanguru/classes/exceptions.py | 285ca44ae857cc61337f73ea2eb600f485a09e32 | # TODO turn prints into actual error raise, they are print for testing
def qSystemInitErrors(init):
def newFunction(obj, **kwargs):
init(obj, **kwargs)
if obj._genericQSys__dimension is None:
className = obj.__class__.__name__
print(className + ' requires a dimension')
... | [] |
alexnikulkov/ReAgent | reagent/gym/tests/test_gym.py | e404c5772ea4118105c2eb136ca96ad5ca8e01db | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import logging
import os
import pprint
import unittest
import numpy as np
# pyre-fixme[21]: Could not find module `pytest`.
import pytest
import torch
from parameterized import parameterized
from reagent.core.types import R... | [((1286, 1313), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1303, 1313), False, 'import logging\n'), ((2639, 2664), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (2654, 2664), False, 'import os\n'), ((2776, 2807), 'parameterized.parameterized.expand', 'para... |
CommissarSilver/TC-Bot | src/deep_dialog/usersims/usersim.py | 4579706a18028b5da9b8a7807fb2e2d4043dcaf8 |
"""
Created on June 7, 2016
a rule-based user simulator
@author: xiul, t-zalipt
"""
import random
class UserSimulator:
""" Parent class for all user sims to inherit from """
def __init__(self, movie_dict=None, act_set=None, slot_set=None, start_set=None, params=None):
""" Construc... | [((939, 968), 'random.choice', 'random.choice', (['self.start_set'], {}), '(self.start_set)\n', (952, 968), False, 'import random\n')] |
ugolbck/KendallW | kendall_w/__init__.py | ace7c68d6c3c2dfcf6b3ee5fb3817240ed050c9b | from .kendall_w import compute_w
__version__ = (1, 0, 0) | [] |
nielsrolf/django-error-logs | admin.py | 4e516e021d34e255f1282c98bffa53a265c48bab | from django.contrib import admin
from .models import *
# Register your models here.
admin.site.register(ErrorGroup)
admin.site.register(Error) | [((84, 115), 'django.contrib.admin.site.register', 'admin.site.register', (['ErrorGroup'], {}), '(ErrorGroup)\n', (103, 115), False, 'from django.contrib import admin\n'), ((116, 142), 'django.contrib.admin.site.register', 'admin.site.register', (['Error'], {}), '(Error)\n', (135, 142), False, 'from django.contrib impo... |
mcpython4-coding/core | mcpython/common/block/ISlab.py | e4c4f59dab68c90e2028db3add2e5065116bf4a6 | """
mcpython - a minecraft clone written in python licenced under the MIT-licence
(https://github.com/mcpython4-coding/core)
Contributors: uuk, xkcdjerry (inactive)
Based on the game of fogleman (https://github.com/fogleman/Minecraft), licenced under the MIT-licence
Original game "minecraft" by Mojang Studios (www.m... | [] |
stancsz/web-development-project-ensf-607 | CourseOutlineBackend/courseoutline/serializers.py | 03b11df4971afd4f27fee54a1800a40d4cc10240 | from rest_framework import serializers
from .models import *
class CoordinatorSerializer(serializers.ModelSerializer):
# ModelID = serializers.CharField(max_length=100, required=True)
CourseID = serializers.CharField(max_length=100, required=True)
FName = serializers.CharField(max_length=100, required=Fa... | [((206, 258), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'max_length': '(100)', 'required': '(True)'}), '(max_length=100, required=True)\n', (227, 258), False, 'from rest_framework import serializers\n'), ((271, 324), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'ma... |
oliverscheer/python-pytest-ci | tools/math_tools.py | d67c379440d1873a753c47e7031bb9564d96de21 | """ some math tools """
class MathTools:
""" some math tools """
def add(a, b):
""" add two values """
return a + b
def sub(a, b):
""" subtract two values """
| [] |
ATrain951/01.python-com_Qproject | hackerrank/Algorithms/Correctness and the Loop Invariant/solution.py | c164dd093954d006538020bdf2e59e716b24d67c | def insertion_sort(l):
for i in range(1, len(l)):
j = i - 1
key = l[i]
while (j >= 0) and (l[j] > key):
l[j + 1] = l[j]
j -= 1
l[j + 1] = key
m = int(input().strip())
ar = [int(i) for i in input().strip().split()]
insertion_sort(ar)
print(" ".join(map(str, a... | [] |
kakkotetsu/CVP-Scripts | cvp_rest_api_examples/cvpLabelAdd.py | 4075eaf9987be6220a7bed188dcee11f56a7bf35 | #!/usrb/bin/env python
# Copyright (c) 2019, Arista Networks, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# - Redistributions of source code must retain the above copyright notice,
# t... | [] |
raikonenfnu/mlir-npcomp | frontends/pytorch/python/torch_mlir_torchscript_e2e_test_configs/torchscript.py | 29e1b2fe89848d58c9bc07e7df7ce651850a5244 | # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
import copy
from typing import Any
import torch
from torch_mlir_torchscript.e2e_test.framework import TestConfig, Tr... | [((591, 616), 'torch.jit.script', 'torch.jit.script', (['program'], {}), '(program)\n', (607, 616), False, 'import torch\n'), ((1104, 1168), 'torch_mlir_torchscript.e2e_test.framework.TraceItem', 'TraceItem', ([], {'symbol': 'item.symbol', 'inputs': 'item.inputs', 'output': 'output'}), '(symbol=item.symbol, inputs=item... |
gdmgent-1718-wot/interactive-wall | app/balltracking/pubnubpython/pnconfiguration.py | af7ecff126b1ee9c85c270fe13d1338aa790c34b | from .enums import PNHeartbeatNotificationOptions, PNReconnectionPolicy
from . import utils
class PNConfiguration(object):
DEFAULT_PRESENCE_TIMEOUT = 300
DEFAULT_HEARTBEAT_INTERVAL = 280
def __init__(self):
# TODO: add validation
self.uuid = None
self.origin = "ps.pndsn.com"
... | [] |
lmaciejonczyk/openthread | tests/scripts/thread-cert/thread_cert.py | 9ca79ddd9af3d4e3f78cb6e611a3117a71b2198c | #!/usr/bin/env python3
#
# Copyright (c) 2019, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... | [((2144, 2178), 'os.getenv', 'os.getenv', (['"""THREAD_VERSION"""', '"""1.1"""'], {}), "('THREAD_VERSION', '1.1')\n", (2153, 2178), False, 'import os\n'), ((1904, 1939), 'os.getenv', 'os.getenv', (['"""PACKET_VERIFICATION"""', '(0)'], {}), "('PACKET_VERIFICATION', 0)\n", (1913, 1939), False, 'import os\n'), ((2091, 212... |
Anurag-Varma/facemask-detection | FaceMaskDetection with webcam.py | 9ac681261e246e6ab1837c576d933dc7324e3a92 |
import cv2
import numpy as np
from keras.models import model_from_json
from keras.preprocessing.image import img_to_array
#load model
model = model_from_json(open("fer.json", "r").read()) #change the path accoring to files
#load weights
model.load_weights('fer.h5') #change the path accor... | [((472, 515), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['detection_model_path'], {}), '(detection_model_path)\n', (493, 515), False, 'import cv2\n'), ((564, 583), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (580, 583), False, 'import cv2\n'), ((1747, 1770), 'cv2.destroyAllWindows', 'cv2.de... |
Binary-bug/Python | language/Basics/stringformatting.py | 233425ded6abc26c889599a82a181487789e3bab | age = 24
print("My age is " + str(age) + " years ")
# the above procedure is tedious since we dont really want to include str for every number we encounter
#Method1 Replacement Fields
print("My age is {0} years ".format(age)) # {0} is the actual replacement field, number important for multiple replacement fields
... | [] |
ulrikpedersen/toggl-gnome-applet | toggl.py | ae48358414d14d44ef5731c59f1813bac97e3257 | #!/usr/bin/env python
import logging
from datetime import datetime
logging.basicConfig(level=logging.WARNING)
import os
import urllib2, base64, json
import dateutil.parser
def from_ISO8601( str_iso8601 ):
return dateutil.parser.parse(str_iso8601)
def to_ISO8601( timestamp ):
return timestamp.isoformat()
de... | [((68, 110), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.WARNING'}), '(level=logging.WARNING)\n', (87, 110), False, 'import logging\n'), ((792, 818), 'logging.getLogger', 'logging.getLogger', (['"""Toggl"""'], {}), "('Toggl')\n", (809, 818), False, 'import logging\n'), ((2098, 2127), 'urllib2.... |
ISMHinoLab/geodesical_skew_divergence | gs_divergence/symmetrized_geodesical_skew_divergence.py | 293648a30e86bdd14749af5b107f1d3687d67700 | from typing import Optional
import torch
from gs_divergence import gs_div
def symmetrized_gs_div(
input: torch.Tensor,
target: torch.Tensor,
alpha: float = -1,
lmd: float = 0.5,
reduction: Optional[str] = 'sum',
) -> torch.Tensor:
lhs = gs_div(input, target, alpha=alpha, lmd=lmd, reduction=re... | [((264, 328), 'gs_divergence.gs_div', 'gs_div', (['input', 'target'], {'alpha': 'alpha', 'lmd': 'lmd', 'reduction': 'reduction'}), '(input, target, alpha=alpha, lmd=lmd, reduction=reduction)\n', (270, 328), False, 'from gs_divergence import gs_div\n'), ((339, 403), 'gs_divergence.gs_div', 'gs_div', (['target', 'input']... |
kushaliitm/deep-learning | train.py | ab8e23d1414d3b79bbe4a3acd57a475f6def7277 | import argparse
import helper as hp
import torch
import os
import json
parser = argparse.ArgumentParser(description = 'train.py')
parser.add_argument('--data-dir', nargs = '*', action = "store", default = "./flowers/", help = "folder path for data")
parser.add_argument('--save-dir', action = "store", required=True, h... | [((81, 128), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""train.py"""'}), "(description='train.py')\n", (104, 128), False, 'import argparse\n'), ((1558, 1581), 'helper.load_data', 'hp.load_data', (['data_path'], {}), '(data_path)\n', (1570, 1581), True, 'import helper as hp\n'), ((1594... |
rbarillec/project_euler | Euler0001.py | db812f9ae53090b34716452d0cb9ec14bf218290 | def Euler0001():
max = 1000
sum = 0
for i in range(1, max):
if i%3 == 0 or i%5 == 0:
sum += i
print(sum)
Euler0001() | [] |
lmathia2/BLIP | models/blip.py | 8ca42256e83654858856d40886509be8fbca51a7 | '''
* Copyright (c) 2022, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
* By Junnan Li
'''
import warnings
warnings.filterwarnings("ignore")
from models.vit import V... | [((261, 294), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (284, 294), False, 'import warnings\n'), ((8350, 8400), 'transformers.BertTokenizer.from_pretrained', 'BertTokenizer.from_pretrained', (['"""bert-base-uncased"""'], {}), "('bert-base-uncased')\n", (8379, 8400), F... |
OliviaNabbosa89/Disaster_Responses | venv/Lib/site-packages/pandas/tests/reshape/merge/test_multi.py | 1e66d77c303cec685dfc2ca94f4fca4cc9400570 | import numpy as np
from numpy.random import randn
import pytest
import pandas as pd
from pandas import DataFrame, Index, MultiIndex, Series
import pandas._testing as tm
from pandas.core.reshape.concat import concat
from pandas.core.reshape.merge import merge
@pytest.fixture
def left():
"""left dataf... | [((641, 694), 'pandas.DataFrame', 'DataFrame', (["{'key1': key1, 'key2': key2, 'data': data}"], {}), "({'key1': key1, 'key2': key2, 'data': data})\n", (650, 694), False, 'from pandas import DataFrame, Index, MultiIndex, Series\n'), ((813, 991), 'pandas.MultiIndex', 'MultiIndex', ([], {'levels': "[['foo', 'bar', 'baz', ... |
mmiladi/galaxy | test/api/test_histories.py | 7857b152cd10d9490ac2433ff2905ca1a47ee32c | # -*- coding: utf-8 -*-
from requests import (
get,
post,
put
)
from base import api # noqa: I100
from base.populators import ( # noqa: I100
DatasetCollectionPopulator,
DatasetPopulator,
wait_on
)
class HistoriesApiTestCase(api.ApiTestCase):
def setUp(self):
super(HistoriesApiT... | [((376, 416), 'base.populators.DatasetPopulator', 'DatasetPopulator', (['self.galaxy_interactor'], {}), '(self.galaxy_interactor)\n', (392, 416), False, 'from base.populators import DatasetCollectionPopulator, DatasetPopulator, wait_on\n'), ((461, 511), 'base.populators.DatasetCollectionPopulator', 'DatasetCollectionPo... |
VinceW0/Leetcode_Python_solutions | Algorithms_easy/0461. Hamming Distance.py | 09e9720afce21632372431606ebec4129eb79734 | """
0461. Hamming Distance
The Hamming distance between two integers is the number of positions at which the corresponding bits are different.
Given two integers x and y, calculate the Hamming distance.
Note:
0 ≤ x, y < 231.
Example:
Input: x = 1, y = 4
Output: 2
Explanation:
1 (0 0 0 1)
4 (0 1 0 0)
↑ ... | [] |
CoderXAndZ/PycharmProjects | AllProjects/Projects/Spider/DownloadImage.py | 94b3cc68d39614a4291bd63d4811dab61eb2e64a | #! /usr/local/bin/python3
# -*- coding: UTF-8 -*-
# 抓取 妹子图 并存储
import urllib.request
import os
import random
def open_url(url):
request = urllib.request.Request(url)
request.add_header('User-Agent',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Firefox/60.0')
... | [((1697, 1719), 'os.path.exists', 'os.path.exists', (['folder'], {}), '(folder)\n', (1711, 1719), False, 'import os\n'), ((1738, 1754), 'os.mkdir', 'os.mkdir', (['folder'], {}), '(folder)\n', (1746, 1754), False, 'import os\n'), ((1763, 1779), 'os.chdir', 'os.chdir', (['folder'], {}), '(folder)\n', (1771, 1779), False,... |
BA-HanseML/NF_Prj_MIMII_Dataset | utility/extractor_batch.py | c9dd130a48c5ee28491a3f9369ace8f7217753d6 | print('load extractor_batch')
# Utility to run multiple feature extraction
# diagrams over many files with multiple threats
import pandas as pd
import os
import sys
import glob
from tqdm.auto import tqdm
from queue import Queue
from threading import Thread
from datetime import datetime
import time
im... | [((1020, 1034), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1032, 1034), False, 'from datetime import datetime\n'), ((2848, 2865), 'tqdm.auto.tqdm', 'tqdm', ([], {'total': 'total'}), '(total=total)\n', (2852, 2865), False, 'from tqdm.auto import tqdm\n'), ((4071, 4099), 'os.path.abspath', 'os.path.abspa... |
cmalek/django-site-multitenancy | multitenancy/context_processors.py | 1b943f63c0d6247529805e05dcced68ceffa2a69 | from .models import Tenant
def tenant(request):
"""
Return context variables required by apps that use django-site-multitenancy.
If there is no 'tenant' attribute in the request, extract one from the request.
"""
if hasattr(request, 'tenant'):
tenant = request.tenant
else:
ten... | [] |
odhiambocuttice/mypersonalapp | hello/forms.py | b2fb12046302104569aa5c4e4869aeb669e51b1b | from django import forms
from .models import Project
class ProjectForm(forms.ModelForm):
class Meta:
model = Project
fields = ["title", "describe", "technology"]
| [] |
mottaquikarim/pydev-psets | pset_classes/class_basics/solutions/p1.py | 9749e0d216ee0a5c586d0d3013ef481cc21dee27 | """
Person class
"""
# Create a Person class with the following properties
# 1. name
# 2. age
# 3. social security number
class Person:
def __init__(self, name, age, social_number):
self.name = name
self.age = age
self.social = social_number
p1 = Person("John", 36, "111-11-1111")
print... | [] |
huangxu96/Paddle | python/paddle/fluid/contrib/slim/tests/test_imperative_out_scale.py | 372ac08a171d76c745deaab0feed2d587798f734 | # copyright (c) 2018 paddlepaddle authors. all rights reserved.
#
# 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 app... | [((1541, 1563), 'paddle.enable_static', 'paddle.enable_static', ([], {}), '()\n', (1561, 1563), False, 'import paddle\n'), ((1596, 1624), 'paddle.fluid.core.is_compiled_with_cuda', 'core.is_compiled_with_cuda', ([], {}), '()\n', (1622, 1624), False, 'from paddle.fluid import core\n'), ((1694, 1779), 'paddle.fluid.log_h... |
nickamon/grr | grr/server/hunts/results.py | ad1936c74728de00db90f6fafa47892b54cfc92d | #!/usr/bin/env python
"""Classes to store and manage hunt results.
"""
from grr.lib import rdfvalue
from grr.lib import registry
from grr.lib.rdfvalues import structs as rdf_structs
from grr_response_proto import jobs_pb2
from grr.server import access_control
from grr.server import aff4
from grr.server import data_sto... | [((898, 941), 'grr.lib.rdfvalue.RDFURN', 'rdfvalue.RDFURN', (['"""aff4:/hunt_results_queue"""'], {}), "('aff4:/hunt_results_queue')\n", (913, 941), False, 'from grr.lib import rdfvalue\n'), ((695, 831), 'grr.server.data_store.Record', 'data_store.Record', ([], {'queue_id': 'self.result_collection_urn', 'timestamp': 'se... |
NodeJSmith/py-simple-rest-sharepoint | src/simple_sharepoint/site.py | 77ee5f76364e7b6096228945ed7e3bd637214a66 | """
Module for higher level SharePoint REST api actions - utilize methods in the api.py module
"""
class Site():
def __init__(self, sp):
self.sp = sp
@property
def info(self):
endpoint = "_api/site"
value = self.sp.get(endpoint).json()
return value
@property
def w... | [] |
rcooke-ast/PYPIT | pypeit/tests/test_metadata.py | 0cb9c4cb422736b855065a35aefc2bdba6d51dd0 | import os
import glob
import shutil
import yaml
from IPython import embed
import pytest
import numpy as np
from pypeit.par.util import parse_pypeit_file
from pypeit.pypeitsetup import PypeItSetup
from pypeit.tests.tstutils import dev_suite_required, data_path
from pypeit.metadata import PypeItMetaData
from pypeit.s... | [((547, 571), 'pypeit.tests.tstutils.data_path', 'data_path', (['"""setup_files"""'], {}), "('setup_files')\n", (556, 571), False, 'from pypeit.tests.tstutils import dev_suite_required, data_path\n'), ((579, 603), 'os.path.isdir', 'os.path.isdir', (['setup_dir'], {}), '(setup_dir)\n', (592, 603), False, 'import os\n'),... |
DDevine/tortoise-orm | tortoise/query_utils.py | 414737a78e98ffd247174590720f5c90aeac4dde | from copy import copy
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Type, cast
from pypika import Table
from pypika.terms import Criterion
from tortoise.exceptions import FieldError, OperationalError
from tortoise.fields.relational import BackwardFKRelation, ManyToManyFieldInstance, RelationalFi... | [((1917, 1945), 'pypika.Table', 'Table', (['related_field.through'], {}), '(related_field.through)\n', (1922, 1945), False, 'from pypika import Table\n'), ((9309, 9374), 'typing.cast', 'cast', (['RelationalField', 'model._meta.fields_map[related_field_name]'], {}), '(RelationalField, model._meta.fields_map[related_fiel... |
angelmtenor/IDAFC | L3_numpy_pandas_2D/B_NumPy_Axis.py | 9d23746fd02e4eda2569d75b3c7a1383277e6e78 | import numpy as np
# Change False to True for this block of code to see what it does
# NumPy axis argument
if True:
a = np.array([
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
])
print(a.sum())
print(a.sum(axis=0))
print(a.sum(axis=1))
# Subway ridership for 5 stations on 10 different... | [((338, 652), 'numpy.array', 'np.array', (['[[0, 0, 2, 5, 0], [1478, 3877, 3674, 2328, 2539], [1613, 4088, 3991, 6461, \n 2691], [1560, 3392, 3826, 4787, 2613], [1608, 4802, 3932, 4477, 2705],\n [1576, 3933, 3909, 4979, 2685], [95, 229, 255, 496, 201], [2, 0, 1, 27,\n 0], [1438, 3785, 3589, 4174, 2215], [1342,... |
WeilabMSU/TopologyNet | Protein-ligand-binding/TopBio/Feature/LigandFeature.py | 4f4d13cec7e50624b43990c863dd84b8bbf359d8 | import numpy as np
import pickle
import os
def GenerateFeature_alpha(ligand_name, working_dir):
Cut = 12.0
LIGELE = ['C','N','O','S','CN','CO','CS','NO','NS','OS','CCl','CBr','CP','CF','CNO','CNS','COS','NOS','CNOS','CNOSPFClBrI','H','CH','NH','OH','SH','CNH','COH','CSH','NOH','NSH','OSH','CNOH','CNSH','COSH'... | [((500, 519), 'pickle.load', 'pickle.load', (['InFile'], {}), '(InFile)\n', (511, 519), False, 'import pickle\n'), ((4686, 4714), 'numpy.asarray', 'np.asarray', (['Feature_i', 'float'], {}), '(Feature_i, float)\n', (4696, 4714), True, 'import numpy as np\n'), ((4806, 4833), 'numpy.save', 'np.save', (['outfile', 'Featur... |
emersion/python-emailthreads | emailthreads/util.py | 99f1a04fa0dd2ce8a9c870016b067bf56f3d3bfd | import re
import sys
from email.message import EmailMessage
def get_message_by_id(msgs, msg_id):
# TODO: handle weird brackets stuff
for msg in msgs:
if msg["message-id"] == msg_id:
return msg
return None
def strip_prefix(s, prefix):
if s.startswith(prefix):
s = s[len(prefix):]
return s
def flatten_heade... | [] |
JanAlexanderPersonal/covid19_weak_supervision | trainval.py | 5599e48c9945f1e08a2731740bc8f6e44a031703 | from haven import haven_chk as hc
from haven import haven_results as hr
from haven import haven_utils as hu
import torch
import torchvision
import tqdm
import pandas as pd
import pprint
import itertools
import os
import pylab as plt
import exp_configs
import time
import numpy as np
from src import models
from src impo... | [((761, 780), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (778, 780), False, 'import logging\n'), ((836, 859), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (857, 859), False, 'import logging\n'), ((883, 942), 'logging.Formatter', 'logging.Formatter', (['"""%(name)s - %(levelname)s... |
unimauro/eden | languages/pt-br.py | b739d334e6828d0db14b3790f2f5e2666fc83576 | # coding: utf8
{
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" é uma expressão opcional como "field1=\'newvalue\'". Não é possível atualizar ou excluir os resultados de uma junção',
'# of International Staff': '# De equipe internacional'... | [] |
goodchinas/pyxq | pyxq/app/__init__.py | c7f6ea63084c18178049451f30f32f04080a511c | from .. import ba, cb, actor
from ..service import account
class A0(ba.App):
center: cb.CallBackManager
a: account.Account
def __init__(self, stg: actor.GateWay):
a = account.Account()
center = cb.CallBackManager()
stg.init(a=a, center=center, broker=cb.CallBackManager())
... | [] |
AdrianLundell/ldpc-investigation-master-thesis | python-files/Analysis/plot_rber_curve.py | 075f5cd10dae498e4fcda2f4aabedd0e27caf122 | #%%
#Calculate_capacity
| [] |
traff/python_completion_benchmark | 2_b_builtins_dynamic_recall.py | df25caaabf46f8b6eca34d5618052bff7ea8b0bf | import builtins
builtins.foo = 'bar'
foo # foo | [] |
gva-jhabte/gva-data | gva/data/validator/__init__.py | 7a605ff01faa3fd38e91a324341d6166f17544a7 | """
Schema Validation
Tests a dictionary against a schema to test for conformity.
Schema definition is similar to - but not the same as - avro schemas
Supported Types:
- string - a character sequence
- format
- numeric - a number
- min:
- max
- date - a datetime.date or... | [((3861, 3899), 'datetime.datetime.fromisoformat', 'datetime.datetime.fromisoformat', (['value'], {}), '(value)\n', (3892, 3899), False, 'import datetime\n'), ((1398, 1422), 're.compile', 're.compile', (['self.pattern'], {}), '(self.pattern)\n', (1408, 1422), False, 'import re\n'), ((5909, 5935), 'os.path.exists', 'os.... |
umarcor/prjtrellis | fuzzers/ECP5/050-pio_routing/fuzzer.py | 9b3db7ba9a02e7d2f49c52ce062d5b22e320004c | from fuzzconfig import FuzzConfig
import interconnect
import nets
import pytrellis
import re
jobs = [
{
"pos": [(47, 0), (48, 0), (49, 0)],
"cfg": FuzzConfig(job="PIOROUTEL", family="ECP5", device="LFE5U-45F", ncl="pioroute.ncl",
tiles=["MIB_R47C0:PICL0", "MIB_R48C0:PICL1"... | [((1347, 1391), 'pytrellis.load_database', 'pytrellis.load_database', (['"""../../../database"""'], {}), "('../../../database')\n", (1370, 1391), False, 'import pytrellis\n'), ((168, 324), 'fuzzconfig.FuzzConfig', 'FuzzConfig', ([], {'job': '"""PIOROUTEL"""', 'family': '"""ECP5"""', 'device': '"""LFE5U-45F"""', 'ncl': ... |
yecharlie/convnet3d | convnet3d/backend/tensorflow_backend.py | 0b2771eec149b196ef59b58d09eef71c9b201d40 | import tensorflow as tf
def _is_tensor(x):
"""Returns `True` if `x` is a symbolic tensor-like object.
From http://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/ops/image_ops_impl.py
Args:
x: A python object to check.
Returns:
`True` if `x` is a `tf.Tensor` or `tf.Va... | [((2734, 2768), 'tensorflow.random.uniform', 'tf.random.uniform', (['*args'], {}), '(*args, **kwargs)\n', (2751, 2768), True, 'import tensorflow as tf\n'), ((2808, 2831), 'tensorflow.pad', 'tf.pad', (['*args'], {}), '(*args, **kwargs)\n', (2814, 2831), True, 'import tensorflow as tf\n'), ((2873, 2903), 'tensorflow.math... |
cobrab11/black1-bot | extensions/everywhere.py | 47c1a80029d6183fc990960b422bb3155360702d | # BS mark.1-55
# /* coding: utf-8 */
# BlackSmith plugin
# everywhere_plugin.py
# Coded by: WitcherGeralt (WitcherGeralt@jabber.ru)
# http://witcher-team.ucoz.ru/
def handler_everywhere(type, source, body):
if body:
args = body.split()
if len(args) >= 2:
mtype = args[0].strip().lower()
if mtype == u'чат... | [] |
WZMJ/Algorithms | 0100.same_tree/solution.py | 07f648541d38e24df38bda469665c12df6a50637 | from utils import TreeNode
class Solution:
def is_same_tree(self, p: TreeNode, q: TreeNode) -> bool:
if p is None and q is None:
return True
if not p or not q:
return False
return p.val == q.val and self.is_same_tree(p.left, q.left) and self.is_same_tree(p.right, q.... | [] |
The-Academic-Observatory/mag-archiver | tests/test_azure.py | 76988020047b4ab9eb2d125f5141dfa7297a6fb3 | # Copyright 2020 Curtin University
#
# 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 to in writi... | [((1346, 1390), 'os.getenv', 'os.getenv', (['"""TEST_AZURE_STORAGE_ACCOUNT_NAME"""'], {}), "('TEST_AZURE_STORAGE_ACCOUNT_NAME')\n", (1355, 1390), False, 'import os\n'), ((1418, 1461), 'os.getenv', 'os.getenv', (['"""TEST_AZURE_STORAGE_ACCOUNT_KEY"""'], {}), "('TEST_AZURE_STORAGE_ACCOUNT_KEY')\n", (1427, 1461), False, '... |
uve/tensorflow | tensorflow/contrib/framework/python/framework/tensor_util_test.py | e08079463bf43e5963acc41da1f57e95603f8080 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# 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... | [((16270, 16281), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (16279, 16281), False, 'from tensorflow.python.platform import test\n'), ((2684, 2716), 'tensorflow.contrib.framework.python.framework.tensor_util.assert_scalar_int', 'tensor_util.assert_scalar_int', (['(3)'], {}), '(3)\n', (2713, ... |
vallemrv/tpvB3 | tpv/modals/sugerencias.py | 9988a528b32692b01bd042cc6486188c4dc2109b | # @Author: Manuel Rodriguez <valle>
# @Date: 10-May-2017
# @Email: valle.mrv@gmail.com
# @Last modified by: valle
# @Last modified time: 23-Feb-2018
# @License: Apache license vesion 2.0
from kivy.uix.modalview import ModalView
from kivy.uix.button import Button
from kivy.properties import ObjectProperty, String... | [((374, 414), 'kivy.lang.Builder.load_file', 'Builder.load_file', (['"""view/sugerencias.kv"""'], {}), "('view/sugerencias.kv')\n", (391, 414), False, 'from kivy.lang import Builder\n'), ((459, 495), 'kivy.properties.ObjectProperty', 'ObjectProperty', (['None'], {'allownone': '(True)'}), '(None, allownone=True)\n', (47... |
p7g/dd-trace-py | templates/integration/__init__.py | 141ac0ab6e9962e3b3bafc9de172076075289a19 | """
The foo integration instruments the bar and baz features of the
foo library.
Enabling
~~~~~~~~
The foo integration is enabled automatically when using
:ref:`ddtrace-run <ddtracerun>` or :ref:`patch_all() <patch_all>`.
Or use :ref:`patch() <patch>` to manually enable the integration::
from ddtrace import pa... | [] |
hpagseddy/ZPUI | libs/linux/wpa_cli.py | b82819e523987639c2dfab417f9895d7cd7ce049 | from subprocess import check_output, CalledProcessError
from ast import literal_eval
from time import sleep
from helpers import setup_logger
logger = setup_logger(__name__, "warning")
current_interface = None
#wpa_cli related functions and objects
def wpa_cli_command(*command):
run = ["wpa_cli"]
if current_... | [((152, 185), 'helpers.setup_logger', 'setup_logger', (['__name__', '"""warning"""'], {}), "(__name__, 'warning')\n", (164, 185), False, 'from helpers import setup_logger\n'), ((6151, 6170), 'ast.literal_eval', 'literal_eval', (['value'], {}), '(value)\n', (6163, 6170), False, 'from ast import literal_eval\n'), ((8097,... |
eukreign/python-v8 | demos/ServerSideBrowser.py | f20d7bef766a2ae3573cc536e7d03e07afe9b173 | #!/usr/bin/env python
from __future__ import with_statement
import sys, traceback, os, os.path
import xml.dom.minidom
import logging
class Task(object):
@staticmethod
def waitAll(tasks):
pass
class FetchFile(Task):
def __init__(self, url):
self.url = url
def _... | [] |
WielderOfMjoelnir/pypeira | pypeira/io/fits.py | 4ef554c577875e09f55673f8e6ea53ba129fb37f | from __future__ import division
import fitsio
"""
A FITS file is comprised of segments called Header/Data Units (HDUs), where the first
HDU is called the 'Primary HDU', or 'Primary Array'. The primary data array can contain
a 1-999 dimensional array of 1, 2 or 4 byte integers or 4 or 8 byte floating point numbers
usi... | [((1951, 1992), 'fitsio.read_header', 'fitsio.read_header', (['path', '*args'], {}), '(path, *args, **kwargs)\n', (1969, 1992), False, 'import fitsio\n'), ((2111, 2145), 'fitsio.read', 'fitsio.read', (['path', '*args'], {}), '(path, *args, **kwargs)\n', (2122, 2145), False, 'import fitsio\n')] |
RyanCargan/emscripten | system/lib/update_musl.py | 6d3859f88e1d6394395760153c0a8cfa6a876ac7 | #!/usr/bin/env python3
# Copyright 2021 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
"""Simple script for updating musl from extern... | [((902, 942), 'os.path.join', 'os.path.join', (['script_dir', '"""libc"""', '"""musl"""'], {}), "(script_dir, 'libc', 'musl')\n", (914, 942), False, 'import os\n'), ((1315, 1343), 'os.path.abspath', 'os.path.abspath', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (1330, 1343), False, 'import os\n'), ((863, 888), 'os.path.d... |
xiamx/scout_apm_python | src/scout_apm/instruments/pymongo.py | d03dab45f65cf7d1030e11fabf6da4cf6e72ee59 | from __future__ import absolute_import, division, print_function, unicode_literals
import logging
# Used in the exec() call below.
from scout_apm.core.monkey import monkeypatch_method, unpatch_method # noqa: F401
from scout_apm.core.tracked_request import TrackedRequest # noqa: F401
logger = logging.getLogger(__na... | [((298, 325), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (315, 325), False, 'import logging\n'), ((3319, 3357), 'scout_apm.core.monkey.unpatch_method', 'unpatch_method', (['Collection', 'method_str'], {}), '(Collection, method_str)\n', (3333, 3357), False, 'from scout_apm.core.monkey ... |
uktrade/tamato | measures/tests/factories.py | 4ba2ffb25eea2887e4e081c81da7634cd7b4f9ca | import random
from typing import Optional
import factory
from common.tests import factories
from measures.sheet_importers import MeasureSheetRow
class MeasureSheetRowFactory(factory.Factory):
"""
A factory that produces a row that might be read from a sheet of measures as
recognised by the :class:`measu... | [((761, 805), 'factory.SubFactory', 'factory.SubFactory', (['factories.MeasureFactory'], {}), '(factories.MeasureFactory)\n', (779, 805), False, 'import factory\n'), ((821, 880), 'factory.SelfAttribute', 'factory.SelfAttribute', (['"""measure.goods_nomenclature.item_id"""'], {}), "('measure.goods_nomenclature.item_id')... |
Remit/autoscaling-simulator | autoscalingsim/scaling/policiesbuilder/metric/correlator/correlator.py | 091943c0e9eedf9543e9305682a067ab60f56def | from abc import ABC, abstractmethod
import collections
import pandas as pd
from autoscalingsim.utils.error_check import ErrorChecker
class Correlator(ABC):
_Registry = {}
@abstractmethod
def _compute_correlation(self, metrics_vals_1 : pd.Series, metrics_vals_2 : pd.Series, lag : int):
pass
... | [((391, 483), 'autoscalingsim.utils.error_check.ErrorChecker.key_check_and_load', 'ErrorChecker.key_check_and_load', (['"""history_buffer_size"""', 'config', 'self.__class__.__name__'], {}), "('history_buffer_size', config, self.\n __class__.__name__)\n", (422, 483), False, 'from autoscalingsim.utils.error_check imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.