repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
watilde/web-platform-tests | XMLHttpRequest/resources/shift-jis-html.py | 97e16bef6d6599ae805521e2007a9430a12aa144 | def main(request, response):
headers = [("Content-type", "text/html;charset=shift-jis")]
# Shift-JIS bytes for katakana TE SU TO ('test')
content = chr(0x83) + chr(0x65) + chr(0x83) + chr(0x58) + chr(0x83) + chr(0x67);
return headers, content
| [] |
dolfim/django-mail-gmailapi | setup.py | c2f7319329d07d6ecd41e4addc05e47c38fd5e19 | import re
from setuptools import setup, find_packages
import sys
if sys.version_info < (3, 5):
raise 'must use Python version 3.5 or higher'
with open('./gmailapi_backend/__init__.py', 'r') as f:
MATCH_EXPR = "__version__[^'\"]+(['\"])([^'\"]+)"
VERSION = re.search(MATCH_EXPR, f.read()).group(2).strip()
... | [((398, 413), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (411, 413), False, 'from setuptools import setup, find_packages\n')] |
OpenPeerPower/openpeerpower | openpeerpower/scripts/ensure_config.py | 940a04a88e8f78e2d010dc912ad6905ae363503c | """Script to ensure a configuration file exists."""
import argparse
import os
import openpeerpower.config as config_util
from openpeerpower.core import OpenPeerPower
# mypy: allow-untyped-calls, allow-untyped-defs
def run(args):
"""Handle ensure config commandline script."""
parser = argparse.ArgumentParser... | [((297, 406), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Ensure a Open Peer Power config exists, creates one if necessary."""'}), "(description=\n 'Ensure a Open Peer Power config exists, creates one if necessary.')\n", (320, 406), False, 'import argparse\n'), ((998, 1013), 'openp... |
uninhm/kyopro | atcoder/abc132A_fifty_fifty.py | bf6ed9cbf6a5e46cde0291f7aa9d91a8ddf1f5a3 | # Vicfred
# https://atcoder.jp/contests/abc132/tasks/abc132_a
# implementation
S = list(input())
if len(set(S)) == 2:
if S.count(S[0]) == 2:
print("Yes")
quit()
print("No")
| [] |
nrohan09-cloud/dabl | dabl/plot/tests/test_supervised.py | ebc4686c7b16c011bf5266cb6335221309aacb80 | import pytest
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import itertools
from sklearn.datasets import (make_regression, make_blobs, load_digits,
fetch_openml, load_diabetes)
from sklearn.preprocessing import KBinsDiscretizer
from dabl.preprocessing import cle... | [((655, 711), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:the matrix subclass"""'], {}), "('ignore:the matrix subclass')\n", (681, 711), False, 'import pytest\n'), ((4153, 4214), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:Discarding near-constant"""'], {}), "('... |
daniel-theis/multicore-test-harness | scripts/calculate_rank.py | d0ff54ef1c9f9637dd16dd8b85ac1cee8dc49e19 | ################################################################################
# Copyright (c) 2017 Dan Iorga, Tyler Sorenson, Alastair Donaldson
# 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... | [((1611, 1631), 'json.load', 'json.load', (['data_file'], {}), '(data_file)\n', (1620, 1631), False, 'import json\n')] |
marblestation/montysolr | contrib/antlrqueryparser/src/python/generate_asts.py | 50917b4d53caac633fe9d1965f175401b3edc77d |
import sys
import subprocess as sub
import os
"""
Simple utility script to generate HTML charts of how ANTLR parses
every query and what is the resulting AST.
"""
def run(grammar_name, basedir='',
cp='.:/dvt/antlr-142/lib/antlr-3.4-complete.jar:/x/dev/antlr-34/lib/antlr-3.4-complete.jar',
grammardi... | [] |
SSusantAchary/Visual-Perception | visual_perception/Detection/yolov4/__init__.py | b81ffe69ab85e9afb7ee6eece43ac83c8f292285 | """
MIT License
Copyright (c) 2020 Susant Achary <sache.meet@yahoo.com>
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, ... | [((3134, 3167), 'visual_perception.Detection.yolov4.tf.YOLOv4', 'yolo_main', ([], {'shape': 'self.input_shape'}), '(shape=self.input_shape)\n', (3143, 3167), True, 'from visual_perception.Detection.yolov4.tf import YOLOv4 as yolo_main\n'), ((5030, 5074), 'visual_perception.Detection.yolov4.tf.YOLOv4', 'yolo_main', ([],... |
rishab-rb/MyIOTMap | server/mqtt/handler.py | e27a73b58cd3a9aba558ebacfb2bf8b6ef4761aa | import paho.client as mqtt
HOST = 'localhost'
PORT = 1883
class MQTTConnector:
def __init__(self, host, port):
host = host
port = port
client = mqtt.Client()
def connect():
self.client.connect(self.host, self.port, 60)
def run(self):
self.client.loop_... | [] |
HighDeFing/thesis_v4 | scripts/spacy_files/similarity_replacement.py | 2dc9288af75a8b51fe54ed66f520e8aa8a0ab3c7 | #!/bin/env python
from black import main
import spacy
import json
from spacy import displacy
import unidecode
import pandas as pd
import numpy as np
import os
csv_source = "scripts/spacy_files/data/thesis_200_with_school.csv"
df = pd.read_csv(csv_source)
df = df[df['isScan']==False]
df = df.sort_values('isScan', asce... | [((233, 256), 'pandas.read_csv', 'pd.read_csv', (['csv_source'], {}), '(csv_source)\n', (244, 256), True, 'import pandas as pd\n'), ((465, 480), 'json.load', 'json.load', (['file'], {}), '(file)\n', (474, 480), False, 'import json\n'), ((701, 727), 'unidecode.unidecode', 'unidecode.unidecode', (['text1'], {}), '(text1)... |
dat-boris/tensorforce | test/unittest_base.py | d777121b1c971da5500572c5f83173b9229f7370 | # Copyright 2018 Tensorforce Team. 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 applicable la... | [((2312, 2435), 'warnings.filterwarnings', 'warnings.filterwarnings', ([], {'action': '"""ignore"""', 'message': '"""Converting sparse IndexedSlices to a dense Tensor of unknown shape"""'}), "(action='ignore', message=\n 'Converting sparse IndexedSlices to a dense Tensor of unknown shape')\n", (2335, 2435), False, '... |
onaio/mspray | mspray/apps/reveal/__init__.py | b3e0f4b5855abbf0298de6b66f2e9f472f2bf838 | """init module for reveal app"""
# pylint: disable=invalid-name
default_app_config = "mspray.apps.reveal.apps.RevealConfig" # noqa
| [] |
luizerico/PyGuiFW | guifw/models/port.py | d79347db7d4bd9e09fbc53215d79c06ccf16bad5 | from django.db import models
from django import forms
from audit_log.models.managers import AuditLog
# Create your models here.
class Port(models.Model):
name = models.CharField(max_length=250)
port = models.CharField(max_length=250)
description = models.TextField(blank=True)
audit_log = AuditLog()... | [((169, 201), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(250)'}), '(max_length=250)\n', (185, 201), False, 'from django.db import models\n'), ((213, 245), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(250)'}), '(max_length=250)\n', (229, 245), False, 'from django.d... |
karstenv/nmp-arm | app/backend/arm/migrations/0002_auto_20190924_1712.py | 47e45f0391820000f461ab6e994e20eacfffb457 | # Generated by Django 2.2.5 on 2019-09-25 00:12
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('arm', '0001_initial'),
]
operations = [
migrations.DeleteModel(
name='CautionMessage',
),
migrations.Dele... | [((224, 269), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""CautionMessage"""'}), "(name='CautionMessage')\n", (246, 269), False, 'from django.db import migrations\n'), ((305, 351), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""RiskRatingValue"""'}), "... |
taranek/tennis-stats-provider | webcam_demo.py | e95093679a194d30d0727ec8e11d44fc462f6adc | import tensorflow as tf
import json
import math
import cv2
import time
import argparse
import concurrent.futures
import posenet
import keyboard
import sys
import numpy as np
from threading import Thread
from slugify import slugify
parser = argparse.ArgumentParser()
parser.add_argument('--model', type=int, default=101)... | [((241, 266), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (264, 266), False, 'import argparse\n'), ((6386, 6456), 'math.sqrt', 'math.sqrt', (['((pointB[0] - pointA[0]) ** 2 + (pointB[1] - pointA[1]) ** 2)'], {}), '((pointB[0] - pointA[0]) ** 2 + (pointB[1] - pointA[1]) ** 2)\n', (6395, 6456)... |
zsoltn/python-otcextensions | otcextensions/tests/unit/osclient/dcs/v1/fakes.py | 4c0fa22f095ebd5f9636ae72acbae5048096822c | # 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 writing, software
# distrib... | [((1083, 1094), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (1092, 1094), False, 'import mock\n'), ((1181, 1192), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (1190, 1192), False, 'import mock\n'), ((1229, 1240), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (1238, 1240), False, 'import mock\n'), ((1273, 1284), 'mock.Mock... |
csullivan/ffi-navigator | tests/dummy_repo/tvm/python/tvm/api.py | ed47678f9cb8c6d3637bf3219d3cf7b2754b84bb | from ._ffi.base import string_types
from ._ffi.object import register_object, Object
from ._ffi.node import register_node, NodeBase
from ._ffi.node import convert_to_node as _convert_to_node
from ._ffi.node_generic import _scalar_type_inference
from ._ffi.function import Function
from ._ffi.function import _init_api, r... | [] |
Harry24k/adversarial-attacks-pytorch | torchattacks/attacks/multiattack.py | bfa2aa8d6f0c3b8086718f9f31526fcafa6995bb | import copy
import torch
from ..attack import Attack
class MultiAttack(Attack):
r"""
MultiAttack is a class to attack a model with various attacks agains same images and labels.
Arguments:
model (nn.Module): model to attack.
attacks (list): list of attacks.
Examples::
>>> at... | [((1669, 1695), 'torch.max', 'torch.max', (['outputs.data', '(1)'], {}), '(outputs.data, 1)\n', (1678, 1695), False, 'import torch\n'), ((1798, 1832), 'torch.masked_select', 'torch.masked_select', (['fails', 'wrongs'], {}), '(fails, wrongs)\n', (1817, 1832), False, 'import torch\n'), ((2028, 2064), 'torch.masked_select... |
wotchin/openGauss-server | src/manager/om/script/gspylib/inspection/items/os/CheckPortConflict.py | ebd92e92b0cfd76b121d98e4c57a22d334573159 | # -*- coding:utf-8 -*-
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.
#
# openGauss is licensed under Mulan PSL v2.
# You can use this software according to the terms
# and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#
# http://license.coscl.org.cn/MulanPSL2
#
# THIS SOFTWARE... | [((1074, 1105), 'subprocess.getstatusoutput', 'subprocess.getstatusoutput', (['cmd'], {}), '(cmd)\n', (1100, 1105), False, 'import subprocess\n'), ((1848, 1879), 'subprocess.getstatusoutput', 'subprocess.getstatusoutput', (['cmd'], {}), '(cmd)\n', (1874, 1879), False, 'import subprocess\n'), ((2293, 2324), 'subprocess.... |
dfreeman06/wxyz | _scripts/_build.py | 663cf6593f4c0ca12f7b94b61e34c0a8d3cbcdfd | import subprocess
import sys
from . import ROOT, PY_SRC, _run, PY, DIST
CONDA_ORDER = [
"core",
"html",
"lab",
"datagrid",
"svg",
"tpl-jjinja"
"yaml"
]
CONDA_BUILD_ARGS = [
"conda-build", "-c", "conda-forge", "--output-folder", DIST / "conda-bld",
]
if __name__ == "__main__":
f... | [] |
xiaopowanyi/py_scripts | scripts/C189/C189Checkin.py | 29f240800eefd6e0f91fd098c35ac3c451172ff8 | import requests, time, re, rsa, json, base64
from urllib import parse
s = requests.Session()
username = ""
password = ""
if(username == "" or password == ""):
username = input("账号:")
password = input("密码:")
def main():
login(username, password)
rand = str(round(time.time()*1000))
surl = f'https:... | [((75, 93), 'requests.Session', 'requests.Session', ([], {}), '()\n', (91, 93), False, 'import requests, time, re, rsa, json, base64\n'), ((4011, 4060), 're.findall', 're.findall', (['"""captchaToken\' value=\'(.+?)\'"""', 'r.text'], {}), '("captchaToken\' value=\'(.+?)\'", r.text)\n', (4021, 4060), False, 'import requ... |
lijiacd985/Mplot | Mmint/CGratio.py | adea07aa78a5495cf3551618f6ec2c08fa7c1029 | import subprocess
from .Genome_fasta import get_fasta
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import numpy as np
import pysam
def run(parser):
args = parser.parse_args()
bases,chrs = get_fasta(args.genome)
l={}
for c in chrs:
l[c]=len(bases[c])
chrs = se... | [((72, 93), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (86, 93), False, 'import matplotlib\n'), ((1984, 1996), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1994, 1996), True, 'from matplotlib import pyplot as plt\n'), ((2001, 2017), 'matplotlib.pyplot.subplot', 'plt.subplot', ... |
sethmlarson/furo | src/furo/__init__.py | 1257d884dae9040248380595e06d7d2a1e6eba39 | """A clean customisable Sphinx documentation theme."""
__version__ = "2020.9.8.beta2"
from pathlib import Path
from .body import wrap_tables
from .code import get_pygments_style_colors
from .navigation import get_navigation_tree
from .toc import should_hide_toc
def _html_page_context(app, pagename, templatename, c... | [((1387, 1401), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (1391, 1401), False, 'from pathlib import Path\n')] |
fretboardfreak/potty_oh | experiments/mix_down.py | 70b752c719576c0975e1d2af5aca2fc7abc8abcc | #!/usr/bin/env python3
# Copyright 2016 Curtis Sand
#
# 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 la... | [((963, 1010), 'potty_oh.common.get_cmd_line_parser', 'common.get_cmd_line_parser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (989, 1010), False, 'from potty_oh import common\n'), ((1015, 1054), 'potty_oh.common.ParserArguments.filename', 'common.ParserArguments.filename', (['parser'], {}), '(parser)... |
fabaff/hrepr | tests/test_hrepr.py | f6de915f1d34c47ceab11f5f70e433a30e6de174 | from dataclasses import dataclass
from hrepr import H
from hrepr import hrepr as real_hrepr
from hrepr.h import styledir
from .common import one_test_per_assert
css_hrepr = open(f"{styledir}/hrepr.css", encoding="utf-8").read()
hrepr = real_hrepr.variant(fill_resources=False)
@dataclass
class Point:
x: int
... | [((239, 279), 'hrepr.hrepr.variant', 'real_hrepr.variant', ([], {'fill_resources': '(False)'}), '(fill_resources=False)\n', (257, 279), True, 'from hrepr import hrepr as real_hrepr\n'), ((8050, 8126), 'hrepr.H.meta', 'H.meta', (["{'http-equiv': 'Content-type'}"], {'content': '"""text/html"""', 'charset': '"""UTF-8"""'}... |
shivangdubey/sympy | sympy/assumptions/assume.py | bd3ddd4c71d439c8b623f69a02274dd8a8a82198 | import inspect
from sympy.core.cache import cacheit
from sympy.core.singleton import S
from sympy.core.sympify import _sympify
from sympy.logic.boolalg import Boolean
from sympy.utilities.source import get_class
from contextlib import contextmanager
class AssumptionsContext(set):
"""Set representing assumptions.
... | [((1752, 1765), 'sympy.core.sympify._sympify', '_sympify', (['arg'], {}), '(arg)\n', (1760, 1765), False, 'from sympy.core.sympify import _sympify\n'), ((1781, 1817), 'sympy.logic.boolalg.Boolean.__new__', 'Boolean.__new__', (['cls', 'predicate', 'arg'], {}), '(cls, predicate, arg)\n', (1796, 1817), False, 'from sympy.... |
IDLabResearch/seriesdistancematrix | distancematrix/tests/consumer/test_distance_matrix.py | c0e666d036f24184511e766cee9fdfa55f41df97 | import numpy as np
from unittest import TestCase
import numpy.testing as npt
from distancematrix.util import diag_indices_of
from distancematrix.consumer.distance_matrix import DistanceMatrix
class TestContextualMatrixProfile(TestCase):
def setUp(self):
self.dist_matrix = np.array([
[8.67, 1... | [((289, 1251), 'numpy.array', 'np.array', (['[[8.67, 1.1, 1.77, 1.26, 1.91, 4.29, 6.32, 4.24, 4.64, 5.06, 6.41, 4.07, \n 4.67, 9.32, 5.09], [4.33, 4.99, 0.14, 2.79, 2.1, 6.26, 9.4, 4.14, 5.53,\n 4.26, 8.21, 5.91, 6.83, 9.26, 6.19], [0.16, 9.05, 1.35, 4.78, 7.01, \n 4.36, 5.24, 8.81, 7.9, 5.84, 8.9, 7.88, 3.37,... |
peddamat/home-assistant-supervisor-test | supervisor/const.py | 5da55772bcb2db3c6d8432cbc08e2ac9fbf480c4 | """Constants file for Supervisor."""
from enum import Enum
from ipaddress import ip_network
from pathlib import Path
SUPERVISOR_VERSION = "DEV"
URL_HASSIO_ADDONS = "https://github.com/home-assistant/addons"
URL_HASSIO_APPARMOR = "https://version.home-assistant.io/apparmor.txt"
URL_HASSIO_VERSION = "https://version.ho... | [((371, 384), 'pathlib.Path', 'Path', (['"""/data"""'], {}), "('/data')\n", (375, 384), False, 'from pathlib import Path\n'), ((407, 443), 'pathlib.Path', 'Path', (['SUPERVISOR_DATA', '"""addons.json"""'], {}), "(SUPERVISOR_DATA, 'addons.json')\n", (411, 443), False, 'from pathlib import Path\n'), ((463, 497), 'pathlib... |
jgregoriods/quaesit | quaesit/agent.py | 3846f5084ea4d6c1cbd9a93176ee9dee25e12105 | import inspect
from math import hypot, sin, asin, cos, radians, degrees
from abc import ABCMeta, abstractmethod
from random import randint, choice
from typing import Dict, List, Tuple, Union
class Agent(metaclass=ABCMeta):
"""
Class to represent an agent in an agent-based model.
"""
_id = 0
colo... | [((833, 852), 'random.choice', 'choice', (['self.colors'], {}), '(self.colors)\n', (839, 852), False, 'from random import randint, choice\n'), ((1242, 1274), 'inspect.signature', 'inspect.signature', (['self.__init__'], {}), '(self.__init__)\n', (1259, 1274), False, 'import inspect\n'), ((2409, 2454), 'math.hypot', 'hy... |
vaesl/LRF-Net | models/LRF_COCO_300.py | e44b120dd55288c02852f8e58cda31313525d748 | import torch
import torch.nn as nn
import os
import torch.nn.functional as F
class LDS(nn.Module):
def __init__(self,):
super(LDS, self).__init__()
self.pool1 = nn.MaxPool2d(kernel_size=(2, 2), stride=2, padding=0)
self.pool2 = nn.MaxPool2d(kernel_size=(2, 2), stride=2, padding=0)
... | [((12471, 12519), 'torch.nn.MaxPool2d', 'nn.MaxPool2d', ([], {'kernel_size': '(3)', 'stride': '(1)', 'padding': '(1)'}), '(kernel_size=3, stride=1, padding=1)\n', (12483, 12519), True, 'import torch.nn as nn\n'), ((12532, 12590), 'torch.nn.Conv2d', 'nn.Conv2d', (['(512)', '(1024)'], {'kernel_size': '(3)', 'padding': '(... |
chromia/wandplus | tests/test.py | 815127aeee85dbac3bc8fca35971d2153b1898a9 | #!/usr/bin/env python
from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
import wandplus.image as wpi
from wandplus.textutil import calcSuitableFontsize, calcSuitableImagesize
import os
import unittest
tmpdir = '_tmp/'
def save(img, function, channel=False, ext='.png'):
... | [((25402, 25417), 'unittest.main', 'unittest.main', ([], {}), '()\n', (25415, 25417), False, 'import unittest\n'), ((583, 599), 'os.mkdir', 'os.mkdir', (['tmpdir'], {}), '(tmpdir)\n', (591, 599), False, 'import os\n'), ((620, 643), 'wand.image.Image', 'Image', ([], {'filename': '"""rose:"""'}), "(filename='rose:')\n", ... |
tizian/layer-laboratory | src/librender/tests/test_mesh.py | 008cc94b76127e9eb74227fcd3d0145da8ddec30 | import mitsuba
import pytest
import enoki as ek
from enoki.dynamic import Float32 as Float
from mitsuba.python.test.util import fresolver_append_path
from mitsuba.python.util import traverse
def test01_create_mesh(variant_scalar_rgb):
from mitsuba.core import Struct, float_dtype
from mitsuba.render import Me... | [((3953, 4021), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""mesh_format"""', "['obj', 'ply', 'serialized']"], {}), "('mesh_format', ['obj', 'ply', 'serialized'])\n", (3976, 4021), False, 'import pytest\n'), ((4023, 4091), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""features"""', "['norma... |
christopherblanchfield/agsadmin | agsadmin/sharing_admin/community/groups/Group.py | 989cb3795aacf285ccf74ee51b0de26bf2f48bc3 | from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import (ascii, bytes, chr, dict, filter, hex, input, int, map, next, oct, open, pow, range, round, str,
super, zip)
from ...._utils import send_session_request
from ..._PortalEndpointBase import Por... | [((659, 666), 'builtins.super', 'super', ([], {}), '()\n', (664, 666), False, 'from builtins import ascii, bytes, chr, dict, filter, hex, input, int, map, next, oct, open, pow, range, round, str, super, zip\n')] |
code-review-doctor/amy | amy/workshops/migrations/0191_auto_20190809_0936.py | 268c1a199510457891459f3ddd73fcce7fe2b974 | # Generated by Django 2.1.7 on 2019-08-09 09:36
from django.db import migrations, models
def migrate_public_event(apps, schema_editor):
"""Migrate options previously with no contents (displayed as "Other:")
to a new contents ("other").
The field containing these options is in CommonRequest abstract model... | [((3945, 3987), 'django.db.migrations.RunPython', 'migrations.RunPython', (['migrate_public_event'], {}), '(migrate_public_event)\n', (3965, 3987), False, 'from django.db import migrations, models\n'), ((1447, 1781), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)', 'verbose_name': '""... |
yubin1219/GAN | pix2pix/Discriminator.py | 8345095f9816e548c968492efbe92b427b0e06a3 | import torch
import torch.nn as nn
class Discriminator(nn.Module):
def __init__(self, input_nc, ndf=64, norm_layer=nn.BatchNorm2d, use_sigmoid=False) :
super(Discriminator, self).__init__()
self.conv1 = nn.Sequential(
nn.Conv2d(input_nc, ndf, kernel_size=4, stride=2, padding=1),
nn.LeakyReLU(0.2,... | [((235, 295), 'torch.nn.Conv2d', 'nn.Conv2d', (['input_nc', 'ndf'], {'kernel_size': '(4)', 'stride': '(2)', 'padding': '(1)'}), '(input_nc, ndf, kernel_size=4, stride=2, padding=1)\n', (244, 295), True, 'import torch.nn as nn\n'), ((303, 326), 'torch.nn.LeakyReLU', 'nn.LeakyReLU', (['(0.2)', '(True)'], {}), '(0.2, True... |
ANarayan/robustness-gym | tests/slicebuilders/subpopulations/test_length.py | eed2800985631fbbe6491b5f6f0731a067eef78e | from unittest import TestCase
import numpy as np
from robustnessgym.cachedops.spacy import Spacy
from robustnessgym.slicebuilders.subpopulations.length import LengthSubpopulation
from tests.testbeds import MockTestBedv0
class TestLengthSubpopulation(TestCase):
def setUp(self):
self.testbed = MockTestBed... | [((309, 324), 'tests.testbeds.MockTestBedv0', 'MockTestBedv0', ([], {}), '()\n', (322, 324), False, 'from tests.testbeds import MockTestBedv0\n'), ((490, 537), 'robustnessgym.slicebuilders.subpopulations.length.LengthSubpopulation', 'LengthSubpopulation', ([], {'intervals': '[(1, 3), (4, 5)]'}), '(intervals=[(1, 3), (4... |
NickSwainston/pulsar_spectra | pulsar_spectra/catalogue_papers/Jankowski_2018_raw_to_yaml.py | b264aab3f8fc1bb3cad14ef1b93cab519ed5bc69 | import json
from astroquery.vizier import Vizier
with open("Jankowski_2018_raw.txt", "r") as raw_file:
lines = raw_file.readlines()
print(lines)
pulsar_dict = {}
for row in lines[3:]:
row = row.split("|")
print(row)
pulsar = row[0].strip().replace("−", "-")
freqs = []
fluxs = []
flux_e... | [((1103, 1126), 'json.dumps', 'json.dumps', (['pulsar_dict'], {}), '(pulsar_dict)\n', (1113, 1126), False, 'import json\n')] |
NishikaDeSilva/identity-test-integration | integration-tests/run-intg-test.py | dbd1db07aa6d4f4942d772cd56c0b06c355bd43b | # Copyright (c) 2018, WSO2 Inc. (http://wso2.com) 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 ap... | [((3974, 4019), 'pathlib.Path', 'Path', (['(storage_dist_abs_path / datasource_path)'], {}), '(storage_dist_abs_path / datasource_path)\n', (3978, 4019), False, 'from pathlib import Path\n'), ((4031, 4061), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win"""'], {}), "('win')\n", (4054, 4061), False, 'imp... |
rhpvorderman/pytest-notification | src/pytest_notification/sound.py | 3f322ab04914f52525e1b07bc80537d5f9a00250 | # Copyright (c) 2019 Leiden University Medical Center
#
# 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, me... | [((1269, 1285), 'pathlib.Path', 'Path', (['"""applause"""'], {}), "('applause')\n", (1273, 1285), False, 'from pathlib import Path\n'), ((1320, 1334), 'pathlib.Path', 'Path', (['"""buzzer"""'], {}), "('buzzer')\n", (1324, 1334), False, 'from pathlib import Path\n'), ((1205, 1219), 'pathlib.Path', 'Path', (['"""sounds""... |
yaznasivasai/python_codewars | 7KYU/next_prime.py | 25493591dde4649dc9c1ec3bece8191a3bed6818 | from math import sqrt
def is_simple(n: int) -> bool:
if n % 2 == 0 and n != 2:
return False
for i in range (3, int(sqrt(n)) + 2, 2):
if n % i == 0 and n != i:
return False
return True
def next_prime(n: int) -> int:
n += 1
if n <= 2:
return 2
else:
i... | [((133, 140), 'math.sqrt', 'sqrt', (['n'], {}), '(n)\n', (137, 140), False, 'from math import sqrt\n')] |
manxueitp/cozmo-test | cozmo_sdk_examples/if_this_then_that/ifttt_gmail.py | a91b1a4020544cb622bd67385f317931c095d2e8 | #!/usr/bin/env python3
# Copyright (c) 2016 Anki, Inc.
#
# 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 in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | [((4131, 4148), 'aiohttp.web.Application', 'web.Application', ([], {}), '()\n', (4146, 4148), False, 'from aiohttp import web\n'), ((4596, 4648), 're.search', 're.search', (['"""([\\\\w.]+)@([\\\\w.]+)"""', 'from_email_address'], {}), "('([\\\\w.]+)@([\\\\w.]+)', from_email_address)\n", (4605, 4648), False, 'import re\... |
parkus/mypy | plotutils.py | 21043c559dca14abe7508e0f6b2f8053bf376bb8 | # -*- coding: utf-8 -*-
"""
Created on Fri May 30 17:15:27 2014
@author: Parke
"""
from __future__ import division, print_function, absolute_import
import numpy as np
import matplotlib as mplot
import matplotlib.pyplot as plt
import mypy.my_numpy as mnp
dpi = 100
fullwidth = 10.0
halfwidth = 5.0
# use these with li... | [((1184, 1196), 'numpy.array', 'np.array', (['xy'], {}), '(xy)\n', (1192, 1196), True, 'import numpy as np\n'), ((1998, 2009), 'numpy.log10', 'np.log10', (['x'], {}), '(x)\n', (2006, 2009), True, 'import numpy as np\n'), ((2378, 2395), 'numpy.asarray', 'np.asarray', (['edges'], {}), '(edges)\n', (2388, 2395), True, 'im... |
xiaoranppp/si664-final | marvel_world/views.py | f5545c04452fd674ddf1d078444e79ea58385e7e | from django.shortcuts import render,redirect
from django.http import HttpResponse,HttpResponseRedirect
from django.views import generic
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from .models import Character,Comic,Power,CharacterPower,CharacterComic
f... | [((792, 841), 'django.utils.decorators.method_decorator', 'method_decorator', (['login_required'], {'name': '"""dispatch"""'}), "(login_required, name='dispatch')\n", (808, 841), False, 'from django.utils.decorators import method_decorator\n'), ((1187, 1236), 'django.utils.decorators.method_decorator', 'method_decorato... |
au-chrismor/selfdrive | src/rpi/fwd.py | 31325dd7a173bbb16a13e3de4c9598aab0a50632 | """Set-up and execute the main loop"""
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
#Right motor input A
GPIO.setup(18,GPIO.OUT)
#Right motor input B
GPIO.setup(23,GPIO.OUT)
GPIO.output(18,GPIO.HIGH)
GPIO.output(23,GPIO.LOW)
| [((76, 98), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (88, 98), True, 'import RPi.GPIO as GPIO\n'), ((99, 122), 'RPi.GPIO.setwarnings', 'GPIO.setwarnings', (['(False)'], {}), '(False)\n', (115, 122), True, 'import RPi.GPIO as GPIO\n'), ((145, 169), 'RPi.GPIO.setup', 'GPIO.setup', (['(18)',... |
Abel-Huang/simple-image-classifier | util/get_from_db.py | 89d2822c2b06cdec728f734d43d9638f4b601348 | import pymysql
# 连接配置信息
config = {
'host': '127.0.0.1',
'port': 3306,
'user': 'root',
'password': '',
'db': 'classdata',
'charset': 'utf8',
'cursorclass': pymysql.cursors.DictCursor,
}
def get_summary_db(unitag):
# 创建连接
conn = pymysql.connect(**config)
cur = conn.cursor()
... | [((266, 291), 'pymysql.connect', 'pymysql.connect', ([], {}), '(**config)\n', (281, 291), False, 'import pymysql\n'), ((624, 649), 'pymysql.connect', 'pymysql.connect', ([], {}), '(**config)\n', (639, 649), False, 'import pymysql\n')] |
RajapandiR/django-register | registerapp/api.py | cf20829fe3515bdd3112a88a890d83d852f09bde | from rest_framework import viewsets
from rest_framework.views import APIView
from registerapp import serializers
from registerapp import models
class RegisterViewSet(viewsets.ModelViewSet):
serializer_class = serializers.RegisterSerializer
queryset = models.RegisterPage.objects.all()
| [((255, 288), 'registerapp.models.RegisterPage.objects.all', 'models.RegisterPage.objects.all', ([], {}), '()\n', (286, 288), False, 'from registerapp import models\n')] |
luutp/jduck | jduck/robot.py | 3c60a79c926bb9452777cddbebe28982273068a6 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
jduck.py
Description:
Author: luutp
Contact: luubot2207@gmail.com
Created on: 2021/02/27
"""
# Utilities
# %%
# ================================IMPORT PACKAGES====================================
# Utilities
from traitlets.config.configurable import SingletonConfigur... | [((568, 598), 'jduck.DCMotor.DCMotor', 'DCMotor', (['(32)', '(36)', '(38)'], {'alpha': '(1.0)'}), '(32, 36, 38, alpha=1.0)\n', (575, 598), False, 'from jduck.DCMotor import DCMotor\n'), ((626, 656), 'jduck.DCMotor.DCMotor', 'DCMotor', (['(33)', '(35)', '(37)'], {'alpha': '(1.0)'}), '(33, 35, 37, alpha=1.0)\n', (633, 65... |
olirice/nebulo | src/nebulo/gql/alias.py | de9b043fe66d0cb872c5c0f2aca3c5c6f20918a7 | # pylint: disable=missing-class-docstring,invalid-name
import typing
from graphql.language import (
InputObjectTypeDefinitionNode,
InputObjectTypeExtensionNode,
ObjectTypeDefinitionNode,
ObjectTypeExtensionNode,
)
from graphql.type import (
GraphQLArgument,
GraphQLBoolean,
GraphQLEnumType,
... | [] |
rise-lang/iree | integrations/tensorflow/bindings/python/pyiree/tf/compiler/saved_model_test.py | 46ad3fe392d38ce3df6eff7826cc1ab331a40b72 | # Copyright 2019 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 or agreed to in writing,... | [((949, 986), 'importlib.import_module', 'importlib.import_module', (['"""tensorflow"""'], {}), "('tensorflow')\n", (972, 986), False, 'import importlib\n'), ((1225, 1236), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (1233, 1236), False, 'import sys\n'), ((1765, 1794), 'tempfile.TemporaryDirectory', 'tempfile.Tempo... |
taco-chainalysis/pypulsedive | api/models/indicator/child_objects/properties.py | e89a2651e1ef41a1a51ddbeabc1f914a0d4e467d | from .grandchild_objects import Cookies
from .grandchild_objects import Dns
from .grandchild_objects import Dom
from .grandchild_objects import Geo
#from .grandchild_objects import Http
#from .grandchild_objects import Meta
from .grandchild_objects import Ssl
#from .grandchild_objects import WhoIs
class Properties(obj... | [] |
scottdaniel/iRep | iRep/gc_skew.py | 5d31688eeeab057ce54f39698e3f9cc5738e05ad | #!/usr/bin/env python3
"""
script for calculating gc skew
Chris Brown
ctb@berkeley.edu
"""
# python modules
import os
import sys
import argparse
import numpy as np
from scipy import signal
from itertools import cycle, product
# plotting modules
from matplotlib import use as mplUse
mplUse('Agg')
import matplotlib.py... | [((286, 299), 'matplotlib.use', 'mplUse', (['"""Agg"""'], {}), "('Agg')\n", (292, 299), True, 'from matplotlib import use as mplUse\n'), ((445, 512), 'matplotlib.rc', 'rc', (['"""font"""'], {}), "('font', **{'family': 'sans-serif', 'sans-serif': ['Helvetica']})\n", (447, 512), False, 'from matplotlib import rc\n'), ((8... |
Algofiorg/algofi-py-sdk | examples/send_governance_vote_transaction.py | 6100a6726d36db4d4d3287064f0ad1d0b9a05e03 | # This sample is provided for demonstration purposes only.
# It is not intended for production use.
# This example does not constitute trading advice.
import os
from dotenv import dotenv_values
from algosdk import mnemonic, account
from algofi.v1.asset import Asset
from algofi.v1.client import AlgofiTestnetClient, Algo... | [((807, 836), 'os.path.join', 'os.path.join', (['my_path', '""".env"""'], {}), "(my_path, '.env')\n", (819, 836), False, 'import os\n'), ((868, 891), 'dotenv.dotenv_values', 'dotenv_values', (['ENV_PATH'], {}), '(ENV_PATH)\n', (881, 891), False, 'from dotenv import dotenv_values\n'), ((901, 941), 'algosdk.mnemonic.to_p... |
franklx/SOAPpy-py3 | bid/inventoryClient.py | f25afba322e9300ba4ebdd281118b629ca63ba24 | #!/usr/bin/env python
import getopt
import sys
import string
import re
import time
sys.path.insert(1,"..")
from SOAPpy import SOAP
import traceback
DEFAULT_SERVERS_FILE = './inventory.servers'
DEFAULT_METHODS = ('SimpleBuy', 'RequestForQuote','Buy','Ping')
def usage (error = None):
sys.stdout = sys.std... | [((85, 109), 'sys.path.insert', 'sys.path.insert', (['(1)', '""".."""'], {}), "(1, '..')\n", (100, 109), False, 'import sys\n'), ((1354, 1365), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (1362, 1365), False, 'import sys\n'), ((1972, 1983), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (1980, 1983), False, 'impor... |
Pixxeasy/WinTools | src/compile.py | e67c365cd4a7a47a410c25b7df8eeaeedc05dd8d | import os
import json
import shutil
with open("entry.tp") as entry:
entry = json.loads(entry.read())
startcmd = entry['plugin_start_cmd'].split("%TP_PLUGIN_FOLDER%")[1].split("\\")
filedirectory = startcmd[0]
fileName = startcmd[1]
if os.path.exists(filedirectory):
os.remove(os.path.join(os.getcwd(), "Wi... | [((246, 275), 'os.path.exists', 'os.path.exists', (['filedirectory'], {}), '(filedirectory)\n', (260, 275), False, 'import os\n'), ((389, 404), 'os.listdir', 'os.listdir', (['"""."""'], {}), "('.')\n", (399, 404), False, 'import os\n'), ((664, 713), 'os.rename', 'os.rename', (['"""dist\\\\Main.exe"""', '"""dist\\\\WinT... |
tusikalanse/acm-icpc | suda/1121/12.py | 20150f42752b85e286d812e716bb32ae1fa3db70 | for _ in range(int(input())):
x, y = list(map(int, input().split()))
flag = 1
for i in range(x, y + 1):
n = i * i + i + 41
for j in range(2, n):
if j * j > n:
break
if n % j == 0:
flag = 0
break
if flag == 0:
break
if flag:
print("OK")
else:
print("Sorry") | [] |
c2gconsulting/bulkpay | notification/app/node_modules/hiredis/binding.gyp | 224a52427f80a71f66613c367a5596cbd5e97294 | {
'targets': [
{
'target_name': 'hiredis',
'sources': [
'src/hiredis.cc'
, 'src/reader.cc'
],
'include_dirs': ["<!(node -e \"require('nan')\")"],
'dependencies': [
'deps/hiredis.gyp:hiredis-c'
],
'defines': [
'_GNU_SOURCE'
],
... | [] |
Verkhovskaya/PyDL | basic_and.py | 4c3f2d952dd988ff27bf359d2f2cdde65737e062 | from pywire import *
def invert(signal):
if signal:
return False
else:
return True
class Inverter:
def __init__(self, a, b):
b.drive(invert, a)
width = 4
a = Signal(width, io="in")
b = Signal(width, io="out")
Inverter(a, b)
build() | [] |
mhsung/deep-functional-dictionaries | network/evaluate_keypoints.py | 8b3d70c3376339cb1b7baacf7753094cd1ffef45 | # Minhyuk Sung (mhsung@cs.stanford.edu)
# April 2018
import os, sys
BASE_DIR = os.path.normpath(
os.path.join(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(os.path.join(BASE_DIR, '..'))
from datasets import *
from generate_outputs import *
from scipy.optimize import linear_sum_assignment
#impor... | [((180, 208), 'os.path.join', 'os.path.join', (['BASE_DIR', '""".."""'], {}), "(BASE_DIR, '..')\n", (192, 208), False, 'import os, sys\n'), ((779, 799), 'numpy.argmax', 'np.argmax', (['A'], {'axis': '(1)'}), '(A, axis=1)\n', (788, 799), True, 'import numpy as np\n'), ((1753, 1773), 'numpy.array', 'np.array', (['dists_i... |
dvirtz/conan-center-index | recipes/cxxopts/all/conanfile.py | 2e7a6337804325616f8d97e3a5b6f66cc72699cb | import os
from conans import ConanFile, tools
from conans.errors import ConanInvalidConfiguration
class CxxOptsConan(ConanFile):
name = "cxxopts"
homepage = "https://github.com/jarro2783/cxxopts"
url = "https://github.com/conan-io/conan-center-index"
description = "Lightweight C++ option parser librar... | [((1859, 1912), 'conans.tools.get', 'tools.get', ([], {}), "(**self.conan_data['sources'][self.version])\n", (1868, 1912), False, 'from conans import ConanFile, tools\n'), ((1067, 1123), 'conans.tools.check_min_cppstd', 'tools.check_min_cppstd', (['self', 'self._minimum_cpp_standard'], {}), '(self, self._minimum_cpp_st... |
ericgreveson/projecteuler | p_030_039/problem31.py | 1844bf383fca871b82d88ef1eb3a9b1a0e363054 | class CoinArray(list):
"""
Coin list that is hashable for storage in sets
The 8 entries are [1p count, 2p count, 5p count, ... , 200p count]
"""
def __hash__(self):
"""
Hash this as a string
"""
return hash(" ".join([str(i) for i in self]))
def main():
"""
En... | [] |
nasirdec/GCP-AppEngine-Example | video/cloud-client/quickstart/quickstart.py | 3f5ad26ad2c1e3c8deceb5844adfb40cf7c2e53f | #!/usr/bin/env python
# Copyright 2017 Google Inc. 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... | [((873, 923), 'google.cloud.videointelligence.VideoIntelligenceServiceClient', 'videointelligence.VideoIntelligenceServiceClient', ([], {}), '()\n', (921, 923), False, 'from google.cloud import videointelligence\n')] |
platformmaster9/PyAlly | ally/instrument.py | 55400e0835ae3ac5b3cf58e0e8214c6244aeb149 | from . import utils
#################################################
""" INSTRUMENT """
#################################################
def Instrument(symbol):
symbol = str(symbol).upper()
return {
'__symbol' : symbol,
'Sym' : symbol,
'SecTyp' : 'CS',
... | [] |
onaio/airbyte | airbyte-integrations/connectors/source-yahoo-finance-price/integration_tests/acceptance.py | 38302e82a25f1b66742c3febfbff0668556920f2 | #
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
#
import pytest
pytest_plugins = ("source_acceptance_test.plugin",)
@pytest.fixture(scope="session", autouse=True)
def connector_setup():
"""This fixture is a placeholder for external resources that acceptance test might require."""
# TODO: setup t... | [((133, 178), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""', 'autouse': '(True)'}), "(scope='session', autouse=True)\n", (147, 178), False, 'import pytest\n')] |
GawenChen/test_pytest | ddt/__init__.py | da7a29dc43e8027d3fd1a05054480ed7007131c3 | # -*- coding: utf-8 -*-
"""
@Time : 2021/10/9 17:51
@Auth : 潇湘
@File :__init__.py.py
@IDE :PyCharm
@QQ : 810400085
""" | [] |
BiancaMT25/darts | darts/models/linear_regression_model.py | bb550dede6d8927a45aea0d9f3df53de32a6eee2 | """
Standard Regression model
-------------------------
"""
import numpy as np
import pandas as pd
from typing import Union
from ..logging import get_logger
from .regression_model import RegressionModel
from sklearn.linear_model import LinearRegression
logger = get_logger(__name__)
class LinearRegressionModel(Regre... | [((1658, 1684), 'sklearn.linear_model.LinearRegression', 'LinearRegression', ([], {}), '(**kwargs)\n', (1674, 1684), False, 'from sklearn.linear_model import LinearRegression\n')] |
vrautela/hail | hail/python/test/hailtop/utils/test_utils.py | 7db6189b5b1feafa88452b8470e497d9505d9a46 | from hailtop.utils import (partition, url_basename, url_join, url_scheme,
url_and_params, parse_docker_image_reference)
def test_partition_zero_empty():
assert list(partition(0, [])) == []
def test_partition_even_small():
assert list(partition(3, range(3))) == [range(0, 1), range(... | [((1883, 1922), 'hailtop.utils.parse_docker_image_reference', 'parse_docker_image_reference', (['"""animage"""'], {}), "('animage')\n", (1911, 1922), False, 'from hailtop.utils import partition, url_basename, url_join, url_scheme, url_and_params, parse_docker_image_reference\n'), ((2108, 2160), 'hailtop.utils.parse_doc... |
wadi-1000/Vicinity | hood/urls.py | a41f6ec2c532cb06f7444b55073b6879a1fce63a | from django.urls import path,include
from . import views
urlpatterns = [
path('home/', views.home, name = 'home'),
path('add_hood/',views.uploadNeighbourhood, name = 'add_hood'),
path('viewhood/',views.viewHood, name = 'viewhood'),
path('hood/<int:pk>/',views.hood, name = 'hood'),
path('add_bizna/'... | [((78, 116), 'django.urls.path', 'path', (['"""home/"""', 'views.home'], {'name': '"""home"""'}), "('home/', views.home, name='home')\n", (82, 116), False, 'from django.urls import path, include\n'), ((124, 185), 'django.urls.path', 'path', (['"""add_hood/"""', 'views.uploadNeighbourhood'], {'name': '"""add_hood"""'}),... |
chetanya-shrimali/scancode-toolkit | src/licensedcode/tokenize.py | a1a22fb225cbeb211bd6f92272a46f1351f57d6b | # -*- coding: utf-8 -*-
#
# Copyright (c) 2017 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB ... | [((2654, 2691), 're.compile', 're.compile', (['query_pattern', 're.UNICODE'], {}), '(query_pattern, re.UNICODE)\n', (2664, 2691), False, 'import re\n'), ((3237, 3282), 're.compile', 're.compile', (['_text_capture_pattern', 're.UNICODE'], {}), '(_text_capture_pattern, re.UNICODE)\n', (3247, 3282), False, 'import re\n'),... |
ufpa-organization-repositories/evolutionary-computing | homework_05/graficos_3.py | e16786f9619e2b357b94ab91ff3a7b352e6a0d92 | # ensaio = [[[[1, 999.4951009067408, 999.495100909791, '1001100.11100010011001100001001', '100011.10010111010000111110100', '1', '1'], [2, 999.5052434400473, 999.5052434497359, '0000100.11100010011001100001001', '111011.10010111010000111110000', '1', '2'], [3, 999.51676448592, 999.516764613072, '0000100.111000100110011... | [((679784, 679794), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (679792, 679794), True, 'from matplotlib import pyplot as plt\n'), ((679657, 679677), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'fitness'], {}), '(x, fitness)\n', (679665, 679677), True, 'from matplotlib import pyplot as plt\n')] |
alunduil/etest | etest_test/fixtures_test/ebuilds_test/__init__.py | e5f06d7e8c83be369576976f239668545bcbfffd | """Ebuild Test Fixtures."""
import os
from typing import Any, Dict, List
from etest_test import helpers_test
EBUILDS: Dict[str, List[Dict[str, Any]]] = {}
helpers_test.import_directory(__name__, os.path.dirname(__file__))
| [((198, 223), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (213, 223), False, 'import os\n')] |
palucki/RememberIt | src/model.py | 1d66616d4bb1bca026dda031d876dca226ba71ad | import random
from pymongo import MongoClient
from observable import Observable
from phrase import Phrase
class MongoDbProxy:
"""Proxy for MongoDB"""
def __init__(self, url, dbName, tableName):
self.client = MongoClient(url)
self.db = self.client[dbName]
self.table = tableName
... | [((231, 247), 'pymongo.MongoClient', 'MongoClient', (['url'], {}), '(url)\n', (242, 247), False, 'from pymongo import MongoClient\n'), ((2173, 2187), 'observable.Observable', 'Observable', (['{}'], {}), '({})\n', (2183, 2187), False, 'from observable import Observable\n'), ((3500, 3539), 'phrase.Phrase', 'Phrase', (['n... |
chall68/BlackWatch | sampleApplication/clientGenerator.py | 0b95d69e4b7de9213a031557e9aff54ce35b12dd | #!flask/bin/python
#from user import User
from sampleObjects.User import User
from datetime import datetime
from sampleObjects.DetectionPoint import DetectionPoint
import time, requests, random, atexit
def requestGenerator():
userObject = randomUser()
detectionPointObject = randomDetectionPoint()
req = r... | [((1352, 1380), 'atexit.register', 'atexit.register', (['closingTime'], {}), '(closingTime)\n', (1367, 1380), False, 'import time, requests, random, atexit\n'), ((535, 585), 'requests.get', 'requests.get', (['"""http://localhost:5000/getResponses"""'], {}), "('http://localhost:5000/getResponses')\n", (547, 585), False,... |
ridwaniyas/channels-examples | news_collector/collector/consumers.py | 9e6a26c8e6404483695cbd96ebf12fc4ed9956b2 | import asyncio
import json
import datetime
from aiohttp import ClientSession
from channels.generic.http import AsyncHttpConsumer
from .constants import BLOGS
class NewsCollectorAsyncConsumer(AsyncHttpConsumer):
"""
Async HTTP consumer that fetches URLs.
"""
async def handle(self, body):
# Ad... | [((654, 678), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (676, 678), False, 'import asyncio\n'), ((771, 794), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (792, 794), False, 'import datetime\n'), ((1565, 1581), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (15... |
PhilipBuhr/randomCsv | src/randomcsv/FileUtils.py | 34b1da62134077dfe4db2682ee0da386ef380c1d | import os
from pathlib import Path
def write(file_name, content):
Path(os.path.dirname(file_name)).mkdir(parents=True, exist_ok=True)
with open(file_name, 'w') as file:
file.write(content)
def read_line_looping(file_name, count):
i = 0
lines = []
file = open(file_name, 'r')
line = fi... | [((77, 103), 'os.path.dirname', 'os.path.dirname', (['file_name'], {}), '(file_name)\n', (92, 103), False, 'import os\n')] |
vats98754/stringtoiso | stringtoiso/__init__.py | 985da5efa26111ef1d92b7026b5d5d68f0101ef1 | from stringtoiso.convert_to_iso import convert | [] |
PNNL-Comp-Mass-Spec/DtaRefinery | aux_sys_err_prediction_module/additive/R_runmed_spline/my_R_runmed_spline_analysis.py | 609cc90d0322af69aea43c2fc21d9cf05a06797a | from aux_sys_err_prediction_module.additive.R_runmed_spline.my_R_runmed_spline_fit import R_runmed_smooth_spline
from numpy import random, array, median, zeros, arange, hstack
from win32com.client import Dispatch
import math
myName = 'R_runmed_spline'
useMAD = True # use median absolute deviations instead of ... | [((619, 661), 'win32com.client.Dispatch', 'Dispatch', (['"""StatConnectorSrv.StatConnector"""'], {}), "('StatConnectorSrv.StatConnector')\n", (627, 661), False, 'from win32com.client import Dispatch\n'), ((2552, 2596), 'numpy.arange', 'arange', (['sparRange[0]', 'sparRange[1]', 'sparStep'], {}), '(sparRange[0], sparRan... |
Ms2ger/python-zstandard | setup.py | b8ea1f6722a710e252b452554442b84c81049439 | #!/usr/bin/env python
# Copyright (c) 2016-present, Gregory Szorc
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the BSD license. See the LICENSE file for details.
import os
import sys
from setuptools import setup
try:
import cffi
except ImportError:
cffi = None
... | [((414, 459), 'os.environ.get', 'os.environ.get', (['"""ZSTD_WARNINGS_AS_ERRORS"""', '""""""'], {}), "('ZSTD_WARNINGS_AS_ERRORS', '')\n", (428, 459), False, 'import os\n'), ((549, 576), 'sys.argv.remove', 'sys.argv.remove', (['"""--legacy"""'], {}), "('--legacy')\n", (564, 576), False, 'import sys\n'), ((637, 669), 'sy... |
c4st1lh0/Projetos-de-Aula | Escolas/Curso em Video/Back-End/Curso de Python/Mundos/Mundo 01/Exercicio_16.py | e8abc9f4bce6cc8dbc6d7fb5da0f549ac8ef5302 | import math
num = float(input('Digite um numero real qualquer: '))
print('O numero: {} tem a parte inteira {}'.format(num, math.trunc(num))) | [((123, 138), 'math.trunc', 'math.trunc', (['num'], {}), '(num)\n', (133, 138), False, 'import math\n')] |
JarvisUSTC/DARDet | mmdet/ops/orn/functions/__init__.py | debbf476e9750030db67f030a40cf8d4f03e46ee | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
from .active_rotating_filter import active_rotating_filter
from .active_rotating_filter import ActiveRotatingFilter
from .rotation_invariant_encoding import rotation_invariant_encoding
from .rotation_invariant_encoding import RotationI... | [] |
eriknw/sympy | sympy/core/tests/test_cache.py | b7544e2bb74c011f6098a7e886fd77f41776c2c4 | from sympy.core.cache import cacheit
def test_cacheit_doc():
@cacheit
def testfn():
"test docstring"
pass
assert testfn.__doc__ == "test docstring"
assert testfn.__name__ == "testfn"
| [] |
VietDunghacker/VarifocalNet | mmdet/models/losses/ranking_losses.py | f57917afb3c29ceba1d3c4f824d10b9cc53aaa40 | import torch
class RankSort(torch.autograd.Function):
@staticmethod
def forward(ctx, logits, targets, delta_RS=0.50, eps=1e-10):
classification_grads=torch.zeros(logits.shape).cuda()
#Filter fg logits
fg_labels = (targets > 0.)
fg_logits = logits[fg_labels]
fg_targets = targets[fg_labels]
fg_num = l... | [((843, 867), 'torch.argsort', 'torch.argsort', (['fg_logits'], {}), '(fg_logits)\n', (856, 867), False, 'import torch\n'), ((4465, 4489), 'torch.argsort', 'torch.argsort', (['fg_logits'], {}), '(fg_logits)\n', (4478, 4489), False, 'import torch\n'), ((6972, 6996), 'torch.argsort', 'torch.argsort', (['fg_logits'], {}),... |
sadamek/pyIMX | tests/test_dcd_api.py | 52af15e656b400f0812f16cf31d9bf6edbe631ad | # Copyright (c) 2017-2018 Martin Olejar
#
# SPDX-License-Identifier: BSD-3-Clause
# The BSD-3-Clause license for this file can be found in the LICENSE file included with this distribution
# or at https://spdx.org/licenses/BSD-3-Clause.html#licenseText
import os
import pytest
from imx import img
# Used Directories
DAT... | [((417, 455), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""dcd_test.txt"""'], {}), "(DATA_DIR, 'dcd_test.txt')\n", (429, 455), False, 'import os\n'), ((466, 504), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""dcd_test.bin"""'], {}), "(DATA_DIR, 'dcd_test.bin')\n", (478, 504), False, 'import os\n'), ((357, 382)... |
nydailynews/feedutils | recentjson.py | 8cb18b26ebf70033df420f3fece8c2cac363f918 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Return recent items from a json feed. Recent means "In the last X days."
import os
import doctest
import json
import urllib2
import argparse
import types
import gzip
from datetime import datetime, timedelta
from time import mktime
class RecentJson:
""" Methods for in... | [] |
Liastre/pcre2 | maint/MultiStage2.py | ca4fd145ee16acbc67b52b8563ab6e25c67ddfc8 | #! /usr/bin/python
# Multistage table builder
# (c) Peter Kankowski, 2008
##############################################################################
# This script was submitted to the PCRE project by Peter Kankowski as part of
# the upgrading of Unicode property support. The new code speeds up property
# matching... | [((11071, 11115), 're.match', 're.match', (['"""^[^/]+/([^.]+)\\\\.txt$"""', 'file_name'], {}), "('^[^/]+/([^.]+)\\\\.txt$', file_name)\n", (11079, 11115), False, 'import re\n'), ((23298, 23321), 're.sub', 're.sub', (['"""#.*"""', '""""""', 'line'], {}), "('#.*', '', line)\n", (23304, 23321), False, 'import re\n'), ((2... |
ihayhurst/RetroBioCat | setup.py | d674897459c0ab65faad5ed3017c55cf51bcc020 | from setuptools import setup, find_packages
from retrobiocat_web import __version__
with open('requirements.txt') as f:
requirements = f.read().splitlines()
setup(
name = 'retrobiocat_web',
packages = find_packages(),
include_package_data=True,
version = __version__,
license='',
description = 'Retrosynt... | [((209, 224), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (222, 224), False, 'from setuptools import setup, find_packages\n')] |
Lung-Yi/rxn_yield_context | rxn_yield_context/preprocess_data/preprocess/augmentation_utils.py | 116d6f21a1b6dc39016d87c001dc5b142cfb697a | # -*- coding: utf-8 -*-
import pickle
import numpy as np
from rdkit import Chem
from rdkit.Chem import AllChem,DataStructs
def get_classes(path):
f = open(path, 'rb')
dict_ = pickle.load(f)
f.close()
classes = sorted(dict_.items(), key=lambda d: d[1],reverse=True)
classes = [(x,y) fo... | [((196, 210), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (207, 210), False, 'import pickle\n'), ((1698, 1727), 'numpy.concatenate', 'np.concatenate', (['(pfp, rxn_fp)'], {}), '((pfp, rxn_fp))\n', (1712, 1727), True, 'import numpy as np\n'), ((694, 718), 'rdkit.Chem.MolFromSmiles', 'Chem.MolFromSmiles', (['rsmi... |
zanachka/webstruct-demo | src/webstruct-demo/__init__.py | f5b5081760d9a2b7924704041cd74748a5c98664 | import functools
import logging
import random
from flask import Flask, render_template, request
import joblib
from lxml.html import html5parser
import lxml.html
import requests
import yarl
import webstruct.model
import webstruct.sequence_encoding
import webstruct.webannotator
webstruct_demo = Flask(__name__, instan... | [((298, 344), 'flask.Flask', 'Flask', (['__name__'], {'instance_relative_config': '(True)'}), '(__name__, instance_relative_config=True)\n', (303, 344), False, 'from flask import Flask, render_template, request\n'), ((1444, 1462), 'yarl.URL', 'yarl.URL', (['base_url'], {}), '(base_url)\n', (1452, 1462), False, 'import ... |
Liang813/einops | setup.py | 9edce3d9a2d0a2abc51a6aaf86678eac43ffac0c | __author__ = 'Alex Rogozhnikov'
from setuptools import setup
setup(
name="einops",
version='0.3.2',
description="A new flavour of deep learning operations",
long_description=open('README.md', encoding='utf-8').read(),
long_description_content_type='text/markdown',
url='https://github.com/arogo... | [] |
czhu1217/cmimc-online | website/migrations/0084_auto_20210215_1401.py | 5ef49ceec0bb86d8ae120a6ecfd723532e277821 | # Generated by Django 3.1.6 on 2021-02-15 19:01
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('website', '0083_remove_aisubmission_code'),
]
operations = [
migrations.AddField(
model_name='e... | [((373, 403), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(1)'}), '(default=1)\n', (392, 403), False, 'from django.db import migrations, models\n'), ((996, 1132), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.d... |
evandez/low-dimensional-probing | ldp/tasks/dlp.py | 3e4af6644a4db7fdf48bc40c5de4815f9db52a6e | """Core experiments for the dependency label prediction task."""
import collections
import copy
import logging
from typing import (Any, Dict, Iterator, Optional, Sequence, Set, Tuple, Type,
Union)
from ldp import datasets, learning
from ldp.models import probes, projections
from ldp.parse import pt... | [((11285, 11312), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (11302, 11312), False, 'import logging\n'), ((12378, 12427), 'ldp.learning.test', 'learning.test', (['probe', 'test_dataset'], {'device': 'device'}), '(probe, test_dataset, device=device)\n', (12391, 12427), False, 'from ldp... |
naver/PyCQuery | pycquery_krb/common/ccache.py | a72f74f9b7c208a263fc7cdb14a30d0fe21e63b9 | #!/usr/bin/env python3
#
# Author:
# Tamas Jos (@skelsec)
#
import os
import io
import datetime
import glob
import hashlib
from pycquery_krb.protocol.asn1_structs import Ticket, EncryptedData, \
krb5_pvno, KrbCredInfo, EncryptionKey, KRBCRED, TicketFlags, EncKrbCredPart
from pycquery_krb.common.utils import dt_to_k... | [((734, 750), 'io.BytesIO', 'io.BytesIO', (['data'], {}), '(data)\n', (744, 750), False, 'import io\n'), ((3228, 3270), 'pycquery_krb.protocol.asn1_structs.EncryptedData', 'EncryptedData', (["{'etype': 1, 'cipher': b''}"], {}), "({'etype': 1, 'cipher': b''})\n", (3241, 3270), False, 'from pycquery_krb.protocol.asn1_str... |
OpenEye-Contrib/Molecular-List-Logic | getUniformSmiles.py | 82caf41f7d8b94e7448d8e839bdbc0620a8666d7 | #!/opt/az/psf/python/2.7/bin/python
from openeye.oechem import *
import cgi
#creates a list of smiles of the syntax [smiles|molId,smiles|molId]
def process_smiles(smiles):
smiles = smiles.split('\n')
mol = OEGraphMol()
smiles_list=[]
for line in smiles:
if len(line.rstrip())>0:
lin... | [] |
mfem/PyMFEM | mfem/_par/gridfunc.py | b7b7c3d3de1082eac1015e3a313cf513db06fd7b | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
raise Runtime... | [((29887, 29936), '_gridfunc.GridFunction_swigregister', '_gridfunc.GridFunction_swigregister', (['GridFunction'], {}), '(GridFunction)\n', (29922, 29936), False, 'import _gridfunc\n'), ((30872, 30919), '_gridfunc.JumpScaling_swigregister', '_gridfunc.JumpScaling_swigregister', (['JumpScaling'], {}), '(JumpScaling)\n',... |
adcarmichael/tracks | src/tracks/settings.py | 04108bbdaf8554e57e278c1556efa9c5b9603973 | import os
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PWA_SERVICE_WORKER_PATH = os.path.join(
BASE_DIR, 'routes/static/routes/js', 'serv... | [((260, 329), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""routes/static/routes/js"""', '"""serviceworker.js"""'], {}), "(BASE_DIR, 'routes/static/routes/js', 'serviceworker.js')\n", (272, 329), False, 'import os\n'), ((480, 535), 'os.environ.get', 'os.environ.get', (['"""SECRET_KEY"""', '"""asdfkhbsadgui87gjsbdfu... |
akeshavan/pyvista | examples/04-lights/plotter_builtins.py | 45fe8b1c38712776f9b628a60a8662d0716dd52b | """
Plotter Lighting Systems
~~~~~~~~~~~~~~~~~~~~~~~~
The :class:`pyvista.Plotter` class comes with three options for the default
lighting system:
* a light kit consisting of a headlight and four camera lights,
* an illumination system containing three lights arranged around the camera,
* no lighting.
With mes... | [((793, 805), 'pyvista.Plotter', 'pv.Plotter', ([], {}), '()\n', (803, 805), True, 'import pyvista as pv\n'), ((934, 967), 'pyvista.plotting._ALL_PLOTTERS.clear', 'pv.plotting._ALL_PLOTTERS.clear', ([], {}), '()\n', (965, 967), True, 'import pyvista as pv\n'), ((1164, 1176), 'pyvista.Plotter', 'pv.Plotter', ([], {}), '... |
talos-gis/swimport | src/swimport/tests/15_char_arrays/main.py | e8f0fcf02b0c9751b199f750f1f8bc57c8ff54b3 | from swimport.all import *
src = FileSource('src.h')
swim = Swim('example')
swim(pools.c_string)
swim(pools.numpy_arrays(r"../resources", allow_char_arrays=True))
swim(pools.include(src))
assert swim(Function.Behaviour()(src)) > 0
swim.write('example.i')
print('ok!') | [] |
larsoner/ipyvolume | ipyvolume/astro.py | 8603a47aff4531df69ace44efdcf6b85d6e51e51 | import numpy as np
import PIL.Image
import pythreejs
import ipyvolume as ipv
from .datasets import UrlCached
def _randomSO3():
"""return random rotatation matrix, algo by James Arvo"""
u1 = np.random.random()
u2 = np.random.random()
u3 = np.random.random()
R = np.array([[np.cos(2*np.pi*u1), np.si... | [((201, 219), 'numpy.random.random', 'np.random.random', ([], {}), '()\n', (217, 219), True, 'import numpy as np\n'), ((229, 247), 'numpy.random.random', 'np.random.random', ([], {}), '()\n', (245, 247), True, 'import numpy as np\n'), ((257, 275), 'numpy.random.random', 'np.random.random', ([], {}), '()\n', (273, 275),... |
Zrealshadow/DeepFunning | deepfunning/function.py | 5c44210a6b30ea57a0be5f930da4ada540e7e3d0 | '''
* @author Waldinsamkeit
* @email Zenglz_pro@163.com
* @create date 2020-09-25 14:33:38
* @desc
'''
import torch
'''--------------------- Weighted Binary cross Entropy ----------------------'''
'''
In Torch BCELoss, weight is set to every element of input instead of to every class
'''
def weighted_binary_cr... | [((980, 1017), 'torch.clamp', 'torch.clamp', (['y_pred', '(1e-07)', '(1 - 1e-07)'], {}), '(y_pred, 1e-07, 1 - 1e-07)\n', (991, 1017), False, 'import torch\n'), ((671, 687), 'torch.mean', 'torch.mean', (['loss'], {}), '(loss)\n', (681, 687), False, 'import torch\n'), ((592, 609), 'torch.log', 'torch.log', (['output'], {... |
pwitab/dlms-cosem | dlms_cosem/hdlc/address.py | aa9e18e6ef8a4fee30da8b797dad03b0b7847780 | from typing import *
import attr
from dlms_cosem.hdlc import validators
@attr.s(auto_attribs=True)
class HdlcAddress:
"""
A client address shall always be expressed on one byte.
To enable addressing more than one logical device within a single physical device
and to support the multi-drop configurat... | [((77, 102), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)'}), '(auto_attribs=True)\n', (83, 102), False, 'import attr\n'), ((790, 843), 'attr.ib', 'attr.ib', ([], {'validator': '[validators.validate_hdlc_address]'}), '(validator=[validators.validate_hdlc_address])\n', (797, 843), False, 'import attr\n'), ((882, 94... |
RasmusSemmle/scipy | benchmarks/benchmarks/stats.py | 4ffeafe269597e6d41b3335549102cd5611b12cb | from __future__ import division, absolute_import, print_function
import warnings
import numpy as np
try:
import scipy.stats as stats
except ImportError:
pass
from .common import Benchmark
class Anderson_KSamp(Benchmark):
def setup(self, *args):
self.rand = [np.random.normal(loc=i, size=1000) fo... | [((813, 864), 'scipy.stats.fisher_exact', 'stats.fisher_exact', (['self.a'], {'alternative': 'alternative'}), '(self.a, alternative=alternative)\n', (831, 864), True, 'import scipy.stats as stats\n'), ((931, 955), 'numpy.random.seed', 'np.random.seed', (['(12345678)'], {}), '(12345678)\n', (945, 955), True, 'import num... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.