repo_name
stringlengths
7
94
repo_path
stringlengths
4
237
repo_head_hexsha
stringlengths
40
40
content
stringlengths
10
680k
apis
stringlengths
2
680k
KimSoungRyoul/drf_unitteset_study_project
account/views.py
9a0d824bdc6343eeba6209299c077a6e9d280516
# Create your views here. from django.db.models import QuerySet from django.utils.decorators import method_decorator from drf_yasg.utils import swagger_auto_schema from rest_framework import viewsets, status from rest_framework.permissions import IsAuthenticated, AllowAny from rest_framework.response import Response fr...
[((2262, 2354), 'rest_framework.response.Response', 'Response', (["{'id': serializer.data['id']}"], {'status': 'status.HTTP_201_CREATED', 'headers': 'headers'}), "({'id': serializer.data['id']}, status=status.HTTP_201_CREATED,\n headers=headers)\n", (2270, 2354), False, 'from rest_framework.response import Response\...
Mannan2812/azure-cli-extensions
src/front-door/azext_front_door/_validators.py
e2b34efe23795f6db9c59100534a40f0813c3d95
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
[((778, 810), 'azure.cli.core.commands.client_factory.get_subscription_id', 'get_subscription_id', (['cmd.cli_ctx'], {}), '(cmd.cli_ctx)\n', (797, 810), False, 'from azure.cli.core.commands.client_factory import get_subscription_id\n'), ((3279, 3368), 'azext_front_door.vendored_sdks.models.MatchCondition', 'MatchCondit...
DevAerial/mimesis
mimesis/data/int/development.py
33c58ae43e2f6ebc11e5ea7ebe8ac8917b2e1c0b
"""Provides all the data related to the development.""" LICENSES = [ "Apache License, 2.0 (Apache-2.0)", "The BSD 3-Clause License", "The BSD 2-Clause License", "GNU General Public License (GPL)", "General Public License (LGPL)", "MIT License (MIT)", "Mozilla Public License 2.0 (MPL-2.0)", ...
[]
pcmoritz/flow
docs/mathparse.py
bc97132e9e2d05262bb6bbad5bda173fd9f4ae92
""" A preliminary attempt at parsing an RST file's math syntax in order to make math render as inline rather than display mode. This doesn't work as of yet but might be useful. It could, however, be not useful if there's a pandoc option for converting .md to .rst that makes math inline and not display. Keeping it arou...
[((580, 619), 're.findall', 're.findall', (['"""\n.. math:: *\\\\S*\n\n"""', 's'], {}), '("""\n.. math:: *\\\\S*\n\n""", s)\n', (590, 619), False, 'import re\n')]
tailhook/pyzza
lib/layout/primitives.py
610be6ee4bea9b64f8226faf7338523fdafdf2cf
from layout import Shape, Widget from flash.text.engine import TextBlock, TextElement @package('layout') class Poly(Shape): __slots__ = ('fillcolor', 'sequence') def __init__(self, name, fillcolor, seq, states): super().__init__(name, states) self.fillcolor = fillcolor self.sequence = s...
[((1479, 1490), 'flash.text.engine.TextBlock', 'TextBlock', ([], {}), '()\n', (1488, 1490), False, 'from flash.text.engine import TextBlock, TextElement\n'), ((1512, 1547), 'flash.text.engine.TextElement', 'TextElement', (['self.text', 'self.format'], {}), '(self.text, self.format)\n', (1523, 1547), False, 'from flash....
ImportTaste/WebRequest
tests/testing_server.py
0cc385622624de16ec980e0c12d9080d593cab74
import traceback import uuid import socket import logging import os import base64 import zlib import gzip import time import datetime from http import cookies from http.server import BaseHTTPRequestHandler from http.server import HTTPServer from threading import Thread import WebRequest def capture_expected_headers...
[((786, 822), 'logging.getLogger', 'logging.getLogger', (['"""Main.TestServer"""'], {}), "('Main.TestServer')\n", (803, 822), False, 'import logging\n'), ((18747, 18801), 'socket.socket', 'socket.socket', (['socket.AF_INET'], {'type': 'socket.SOCK_STREAM'}), '(socket.AF_INET, type=socket.SOCK_STREAM)\n', (18760, 18801)...
qrowsxi/calcgrades
calcgrades.py
93c71c1afef8dde5174726ae1702b71ccba633de
import csv import math import numpy as np import pandas import scipy.optimize import sys import argparse def ineq_constraint_1(v): return np.array([vi for vi in v]) def ineq_constraint_2(v): return np.array([-vi + 30 for vi in v]) class WeightAverage: def __init__(self, mean, csv): self.df = ...
[((144, 170), 'numpy.array', 'np.array', (['[vi for vi in v]'], {}), '([vi for vi in v])\n', (152, 170), True, 'import numpy as np\n'), ((210, 244), 'numpy.array', 'np.array', (['[(-vi + 30) for vi in v]'], {}), '([(-vi + 30) for vi in v])\n', (218, 244), True, 'import numpy as np\n'), ((2690, 2744), 'argparse.Argument...
AaronFriel/pulumi-google-native
sdk/python/pulumi_google_native/testing/v1/test_matrix.py
75d1cda425e33d4610348972cd70bddf35f1770d
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from ... import _utilities fro...
[((3103, 3142), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""environmentMatrix"""'}), "(name='environmentMatrix')\n", (3116, 3142), False, 'import pulumi\n'), ((3535, 3570), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""resultStorage"""'}), "(name='resultStorage')\n", (3548, 3570), False, 'import pulumi\n'...
MoriokaReimen/ConfigHeaderGenerator
View/View.py
73ba5d3bd5269d7e6881ec79b6fc0121ff2fb03e
import tkinter as tk import tkinter.messagebox from Control import Control class View: def __init__(self, control : Control.Control): self.control = control # Init Window self.root = tk.Tk() self.root.title(u"Header File Generator") self.root.geometry("700x800") se...
[((213, 220), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (218, 220), True, 'import tkinter as tk\n'), ((338, 357), 'tkinter.Frame', 'tk.Frame', (['self.root'], {}), '(self.root)\n', (346, 357), True, 'import tkinter as tk\n'), ((402, 439), 'tkinter.Label', 'tk.Label', (['self.config_frame'], {'width': '(20)'}), '(self.co...
FirebirdSQL/firebird-qa
tests/bugs/core_3355_test.py
96af2def7f905a06f178e2a80a2c8be4a4b44782
#coding:utf-8 # # id: bugs.core_3355 # title: Wrong comparsion of DATE and TIMESTAMP if index is used # decription: # tracker_id: CORE-3355 # min_versions: ['2.1.5'] # versions: 3.0 # qmid: None import pytest from firebird.qa import db_factory, isql_act, Action # version: 3.0 # resou...
[((767, 828), 'firebird.qa.db_factory', 'db_factory', ([], {'page_size': '(4096)', 'sql_dialect': '(3)', 'init': 'init_script_1'}), '(page_size=4096, sql_dialect=3, init=init_script_1)\n', (777, 828), False, 'from firebird.qa import db_factory, isql_act, Action\n'), ((1015, 1077), 'firebird.qa.isql_act', 'isql_act', ([...
hms-dbmi/bch-pic-sure-airflow-dags
dags/download_decrypt_transfer_files.py
0c1e6f07da4e270581942e551ac30284474921d4
""" @author: anilkdegala """ import os from airflow import DAG from airflow.operators.bash_operator import BashOperator from airflow.operators.python_operator import PythonOperator, BranchPythonOperator from datetime import date, timedelta, datetime from collections import OrderedDict from scripts.dag_pebbles import ...
[((585, 605), 'datetime.datetime', 'datetime', (['(2015)', '(6)', '(1)'], {}), '(2015, 6, 1)\n', (593, 605), False, 'from datetime import date, timedelta, datetime\n'), ((1617, 1629), 'scripts.dag_pebbles.DagPebbles', 'DagPebbles', ([], {}), '()\n', (1627, 1629), False, 'from scripts.dag_pebbles import DagPebbles\n'), ...
hashnfv/hashnfv-moon
keystone-moon/keystone/endpoint_policy/controllers.py
daaba34fa2ed4426bc0fde359e54a5e1b872208c
# Copyright 2014 IBM Corp. # # 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, s...
[((691, 762), 'keystone.common.dependency.requires', 'dependency.requires', (['"""policy_api"""', '"""catalog_api"""', '"""endpoint_policy_api"""'], {}), "('policy_api', 'catalog_api', 'endpoint_policy_api')\n", (710, 762), False, 'from keystone.common import dependency\n'), ((2119, 2141), 'keystone.common.controller.p...
ipacheco-uy/NiBetaSeries
src/nibetaseries/cli/run.py
3d8716552f22f925524d80af9aace09469c22d4d
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Module that contains the command line app. Why does this file exist, and why not put this in __main__? You might be tempted to import things from __main__ later, but that will cause problems: the code will get executed twice: - When you run `python -m nibetaser...
[((1046, 1154), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""NiBetaSeries BIDS arguments"""', 'formatter_class': 'RawTextHelpFormatter'}), "(description='NiBetaSeries BIDS arguments',\n formatter_class=RawTextHelpFormatter)\n", (1069, 1154), False, 'import argparse\n'), ((7853, 7883...
astrandb/senz_hass
custom_components/senz/config_flow.py
6725d37fd9c6d250ac10a16e68c56908bf1c8404
"""Config flow for SENZ WiFi.""" from __future__ import annotations import logging from typing import Any import voluptuous as vol from homeassistant.components import persistent_notification from homeassistant.data_entry_flow import FlowResult from homeassistant.helpers import config_entry_oauth2_flow from .const ...
[((646, 673), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (663, 673), False, 'import logging\n'), ((1085, 1355), 'homeassistant.components.persistent_notification.async_create', 'persistent_notification.async_create', (['self.hass', 'f"""Senz integration for account {entry[\'auth_imple...
bsipocz/astropy-helpers
astropy_helpers/git_helpers.py
4999df1cfb6a5022347b0cef9caf8a556517c625
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Utilities for retrieving revision information from a project's git repository. """ # Do not remove the following comment; it is used by # astropy_helpers.version_helpers to determine the beginning of the code in # this module # BEGIN import locale ...
[((5921, 5945), 'os.path.isfile', 'os.path.isfile', (['pathname'], {}), '(pathname)\n', (5935, 5945), False, 'import os\n'), ((2625, 2636), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (2634, 2636), False, 'import os\n'), ((2649, 2668), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (2662, 2668), False, '...
imaroger/sot-talos-balance
src/sot_talos_balance/test/test_feet_admittance.py
5e56700b4e105273ecf6feb3474789beac469a77
'''Test feet admittance control''' from sot_talos_balance.utils.run_test_utils import run_ft_calibration, run_test, runCommandClient try: # Python 2 input = raw_input # noqa except NameError: pass run_test('appli_feet_admittance.py') run_ft_calibration('robot.ftc') input("Wait before running the test") ...
[((212, 248), 'sot_talos_balance.utils.run_test_utils.run_test', 'run_test', (['"""appli_feet_admittance.py"""'], {}), "('appli_feet_admittance.py')\n", (220, 248), False, 'from sot_talos_balance.utils.run_test_utils import run_ft_calibration, run_test, runCommandClient\n'), ((250, 281), 'sot_talos_balance.utils.run_te...
davebryson/py-tendermint
tests/test_db.py
ec6a38a54950d9841759b0f2ed93659b58948a03
import os from tendermint.db import VanillaDB from tendermint.utils import home_dir def test_database(): dbfile = home_dir('temp', 'test.db') db = VanillaDB(dbfile) db.set(b'dave',b'one') result = db.get(b'dave') assert(b'one' == result) db.set(b'dave',b'two') result = db.get(b'dave') ...
[((120, 147), 'tendermint.utils.home_dir', 'home_dir', (['"""temp"""', '"""test.db"""'], {}), "('temp', 'test.db')\n", (128, 147), False, 'from tendermint.utils import home_dir\n'), ((157, 174), 'tendermint.db.VanillaDB', 'VanillaDB', (['dbfile'], {}), '(dbfile)\n', (166, 174), False, 'from tendermint.db import Vanilla...
asb29/Redundant
auth/tests/test_views.py
ee816fd41f9217610bd11f757cf9175288723c70
from django.test import TestCase from django.test import Client class RegisterTestCase(TestCase): def test_register(self): c = Client() # on success redirects to / response = c.post('/accounts/register/', { 'username': 'asdas', 'password1': 'asdasdasd12', ...
[((141, 149), 'django.test.Client', 'Client', ([], {}), '()\n', (147, 149), False, 'from django.test import Client\n')]
iFighting/OneNet
projects/OneNet/onenet/head.py
6e33b46d2aa13131262833c75f0fd1c3d224ef03
# # Modified by Peize Sun # Contact: sunpeize@foxmail.com # # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ OneNet Transformer class. Copy-paste from torch.nn.Transformer with modifications: * positional encodings are passed in MHattention * extra LN at the end of encoder is removed ...
[((2954, 2969), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2967, 2969), False, 'import torch\n'), ((1222, 1295), 'torch.nn.Conv2d', 'nn.Conv2d', (['self.d_model', 'self.d_model'], {'kernel_size': '(3)', 'stride': '(1)', 'padding': '(1)'}), '(self.d_model, self.d_model, kernel_size=3, stride=1, padding=1)\n', ...
HastingsGreer/mermaid
mermaid/utils.py
bd13c5fc427eb8cd9054973a8eaaeb302078182d
"""Various utility functions. .. todo:: Reorganize this package in a more meaningful way. """ from __future__ import print_function from __future__ import absolute_import # from builtins import str # from builtins import range import torch from torch.nn.parameter import Parameter from torch.autograd import Variab...
[((1232, 1251), 'os.path.abspath', 'os.path.abspath', (['sf'], {}), '(sf)\n', (1247, 1251), False, 'import os\n'), ((1304, 1323), 'os.path.abspath', 'os.path.abspath', (['tf'], {}), '(tf)\n', (1319, 1323), False, 'import os\n'), ((1343, 1366), 'os.path.splitext', 'os.path.splitext', (['abs_t'], {}), '(abs_t)\n', (1359,...
fmamashli/mne-python
examples/io/plot_read_evoked.py
52f064415e7c9fa8fe243d22108dcdf3d86505b9
""" ================================== Reading and writing an evoked file ================================== This script shows how to read and write evoked datasets. """ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # # License: BSD (3-clause) from mne import read_evokeds from mne.datasets import sample ...
[((349, 367), 'mne.datasets.sample.data_path', 'sample.data_path', ([], {}), '()\n', (365, 367), False, 'from mne.datasets import sample\n'), ((473, 544), 'mne.read_evokeds', 'read_evokeds', (['fname'], {'condition': 'condition', 'baseline': '(None, 0)', 'proj': '(True)'}), '(fname, condition=condition, baseline=(None,...
lukaszgo1/nvda
source/monkeyPatches/__init__.py
38a2efd1e1bff7db4471cb7afa03ab1590b7adef
# A part of NonVisual Desktop Access (NVDA) # Copyright (C) 2021 NV Access Limited # This file is covered by the GNU General Public License. # See the file COPYING for more details. from . import wxMonkeyPatches applyWxMonkeyPatches = wxMonkeyPatches.apply def applyMonkeyPatches(): # Apply several mon...
[]
nxtreaming/yt-dlp
yt_dlp/extractor/ninenow.py
385ffb467b2285e85a2a5495b90314ba1f8e0700
from .common import InfoExtractor from ..compat import compat_str from ..utils import ( ExtractorError, int_or_none, float_or_none, smuggle_url, str_or_none, try_get, unified_strdate, unified_timestamp, ) class NineNowIE(InfoExtractor): IE_NAME = '9now.com.au' _VALID_URL = r'ht...
[]
mcarilli/apex
apex/fp16_utils/fused_weight_norm.py
766e36c9e10fe4efd847c3f77c3b38974c89eab1
import torch from torch.autograd import Variable from torch.autograd.function import Function, once_differentiable import apex_C def check_contig_cuda(tensors, names): for tensor, name in zip(tensors, names): if not tensor.is_contiguous(): raise RuntimeError(name+" with size {} is not contiguou...
[((3267, 3319), 'apex_C.weight_norm_fwd', 'apex_C.weight_norm_fwd', (['output', 'norms', 'input', 'g', 'dim'], {}), '(output, norms, input, g, dim)\n', (3289, 3319), False, 'import apex_C\n'), ((4443, 4550), 'apex_C.weight_norm_bwd', 'apex_C.weight_norm_bwd', (['grad_input', 'grad_g', 'grad_output_contig', 'savedInput'...
gerardorf/taurus
bzt/modules/grinder.py
610872b4cf70af31d79a346db1aebd3466310d77
""" Module holds all stuff regarding Grinder tool usage Copyright 2015 BlazeMeter 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 at http://www.apache.org/licenses/LICENSE-2.0 Unless require...
[((10071, 10134), 're.compile', 're.compile', (['"""worker\\\\.(\\\\S+) (.+) -> (\\\\S+) (.+), (\\\\d+) bytes"""'], {}), "('worker\\\\.(\\\\S+) (.+) -> (\\\\S+) (.+), (\\\\d+) bytes')\n", (10081, 10134), False, 'import re\n'), ((5650, 5716), 'os.path.join', 'os.path.join', (['self.engine.artifacts_dir', "(self.exec_id ...
moroten/scons
test/Fortran/fixture/myfortran_flags.py
20927b42ed4f0cb87f51287fa3b4b6cf915afcf8
import getopt import sys comment = ('#' + sys.argv[1]).encode() opts, args = getopt.getopt(sys.argv[2:], 'cf:o:xy') optstring = '' length = len(comment) for opt, arg in opts: if opt == '-o': out = arg elif opt not in ('-f', '-K'): optstring = optstring + ' ' + opt infile = open(args[0], 'rb') outfile = open(out...
[((77, 115), 'getopt.getopt', 'getopt.getopt', (['sys.argv[2:]', '"""cf:o:xy"""'], {}), "(sys.argv[2:], 'cf:o:xy')\n", (90, 115), False, 'import getopt\n'), ((455, 466), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (463, 466), False, 'import sys\n')]
Zen-Reportz/zen_knit
zen_knit/organizer/__init__.py
104c2693d2cc61520657131da769f5d59d2df8e9
import io import os import base64 from pathlib import Path from nbconvert import filters from pygments.formatters.latex import LatexFormatter from zen_knit import formattor from zen_knit.data_types import ChunkOption, ExecutedData, OrganizedChunk, OrganizedData from zen_knit.formattor.html_formatter import HTMLFormat...
[((689, 763), 'zen_knit.data_types.OrganizedData', 'OrganizedData', ([], {'global_options': 'self.executed_data.global_options', 'chunks': '[]'}), '(global_options=self.executed_data.global_options, chunks=[])\n', (702, 763), False, 'from zen_knit.data_types import ChunkOption, ExecutedData, OrganizedChunk, OrganizedDa...
mcaniot/qibullet
qibullet/robot_virtual.py
9c5e1b319a18dd289263eb82f9d7303429bcbe21
#!/usr/bin/env python # coding: utf-8 import sys import pybullet from qibullet.camera import * from qibullet.link import Link from qibullet.joint import Joint IS_VERSION_PYTHON_3 = sys.version_info[0] >= 3 class RobotVirtual: """ Mother class representing a virtual robot """ def __init__(self, desc...
[((10608, 10706), 'pybullet.getBasePositionAndOrientation', 'pybullet.getBasePositionAndOrientation', (['self.robot_model'], {'physicsClientId': 'self.physics_client'}), '(self.robot_model, physicsClientId=\n self.physics_client)\n', (10646, 10706), False, 'import pybullet\n'), ((1533, 1773), 'pybullet.loadURDF', 'p...
hbraux/kafkacli
tests/test_formatter.py
5f7ed23150932b66b484fb43dd6210b6c0968776
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import pytest import json from kafkacli.formatter import Formatter sampleJson = json.loads('{"a":"s", "b":1}') def test_print_default(capsys): Formatter().print(sampleJson) captured = capsys.readouterr() assert captured.out == '{"a": "s", "b": 1}\n...
[((138, 168), 'json.loads', 'json.loads', (['"""{"a":"s", "b":1}"""'], {}), '(\'{"a":"s", "b":1}\')\n', (148, 168), False, 'import json\n'), ((207, 218), 'kafkacli.formatter.Formatter', 'Formatter', ([], {}), '()\n', (216, 218), False, 'from kafkacli.formatter import Formatter\n'), ((359, 382), 'kafkacli.formatter.Form...
arc198/DJANGO-JOB-SITE
src/jobs/forms.py
d9547c4ee85751677ba6458380b609973c3b4a8d
from django import forms from .models import Application class ApplicationForm(forms.ModelForm): class Meta: model = Application fields = ('resume', 'cover_letter',)
[]
ylee88/visit
src/test/tests/unit/protocol.py
8e0920996d84fef70a7014b0d770360918d849d5
# ---------------------------------------------------------------------------- # CLASSES: nightly # # Test Case: protocolo.py # # Tests: vistprotocol unit test # # Mark C. Miller, Tue Jan 11 10:19:23 PST 2011 # ---------------------------------------------------------------------------- tapp = visit_bin_path(...
[]
Dozed12/pyMazeBacktrack
pyMazeBacktrack.py
aaa2a902fdca17dca6e2ee00e672b6bb38da5639
import libtcodpy as libtcod from random import randint nSquares = 30 nTiles = nSquares * 2 + 1 SCREEN_WIDTH = nTiles SCREEN_HEIGHT = nTiles libtcod.console_set_custom_font("cp437_12x12.png", libtcod.FONT_LAYOUT_ASCII_INROW) libtcod.console_init_root(SCREEN_WIDTH, SCREEN_HEIGHT, 'pyMazeBacktrack', False, li...
[((152, 240), 'libtcodpy.console_set_custom_font', 'libtcod.console_set_custom_font', (['"""cp437_12x12.png"""', 'libtcod.FONT_LAYOUT_ASCII_INROW'], {}), "('cp437_12x12.png', libtcod.\n FONT_LAYOUT_ASCII_INROW)\n", (183, 240), True, 'import libtcodpy as libtcod\n'), ((237, 347), 'libtcodpy.console_init_root', 'libtc...
aws-solutions/maintaining-personalized-experiences-with-machine-learning
source/tests/test_resources.py
3f6f1b0069df4828eae9b0835b717500189e4f71
# ###################################################################################################################### # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # ...
[((1679, 2586), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""klass,camel,dash,snake"""', "[(DatasetGroup, 'datasetGroup', 'dataset-group', 'dataset_group'), (Schema,\n 'schema', 'schema', 'schema'), (Dataset, 'dataset', 'dataset',\n 'dataset'), (DatasetImportJob, 'datasetImportJob', 'dataset-import...
orlandofv/sianna
app_venv/Lib/site-packages/phonenumbers/data/region_AG.py
f07dd6dbc62a9604f31ab800e482e62f14fba766
"""Auto-generated file, do not edit by hand. AG metadata""" from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata PHONE_METADATA_AG = PhoneMetadata(id='AG', country_code=1, international_prefix='011', general_desc=PhoneNumberDesc(national_number_pattern='(?:268|[58]\\d\\d|900)\\d{7}', possible_l...
[]
lapets/bu-gsubmit-grading
gradefiles-send.py
69c40a763908be1c954dce3e5e5aab854ac379ff
##################################################################### ## ## gradefiles-send.py ## ## Script to send grade files by email to enrolled students; the ## input grade file names should correspond to the user names of ## the students. ## ## from email.mime.text import MIMEText # For creating a message...
[((1925, 1943), 'os.walk', 'os.walk', (['"""./data/"""'], {}), "('./data/')\n", (1932, 1943), False, 'import os\n'), ((679, 692), 'email.mime.text.MIMEText', 'MIMEText', (['txt'], {}), '(txt)\n', (687, 692), False, 'from email.mime.text import MIMEText\n'), ((908, 955), 'subprocess.Popen', 'Popen', (["['/usr/sbin/sendm...
GalAster/16
Publisher/PGGAN-1024 trained on CelebaHQ/2-exporter.py
47560a2132fbe4dda35a35dedfd7d8e6a8acc35a
import os import pickle import tensorflow as tf import wolframclient.serializers as wxf name = 'karras2018iclr-celebahq-1024x1024' file = open(name + '.pkl', 'rb') sess = tf.InteractiveSession() G, D, Gs = pickle.load(file) saver = tf.train.Saver() save_path = "./target/" + name + "/" model_name = 'model' if not os.pa...
[((172, 195), 'tensorflow.InteractiveSession', 'tf.InteractiveSession', ([], {}), '()\n', (193, 195), True, 'import tensorflow as tf\n'), ((207, 224), 'pickle.load', 'pickle.load', (['file'], {}), '(file)\n', (218, 224), False, 'import pickle\n'), ((233, 249), 'tensorflow.train.Saver', 'tf.train.Saver', ([], {}), '()\n...
Quanta-Robotics/Robot-Blueberry
src/moveGoogle.py
7b7e77e09ac5e9ec5afd947e0db1ecc8773e56da
#!/usr/bin/env python import os import os.path import yaml import time import random import multiprocessing import RPi.GPIO as GPIO from talk import say GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) from adafruit_servokit import ServoKit Motor1 = {'EN': 27, 'input1': 19, 'input2': 16} Motor2 = {'EN': 22, 'input1': 2...
[((154, 177), 'RPi.GPIO.setwarnings', 'GPIO.setwarnings', (['(False)'], {}), '(False)\n', (170, 177), True, 'import RPi.GPIO as GPIO\n'), ((178, 200), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (190, 200), True, 'import RPi.GPIO as GPIO\n'), ((434, 461), 'RPi.GPIO.PWM', 'GPIO.PWM', (["Motor...
politbuero-kampagnen/onegov-cloud
src/onegov/translator_directory/models/language.py
20148bf321b71f617b64376fe7249b2b9b9c4aa9
from uuid import uuid4 from sqlalchemy import Index, Column, Text, Table, ForeignKey from sqlalchemy.orm import object_session from onegov.core.orm import Base from onegov.core.orm.types import UUID spoken_association_table = Table( 'spoken_lang_association', Base.metadata, Column( 'translator_i...
[((1180, 1225), 'sqlalchemy.Column', 'Column', (['UUID'], {'primary_key': '(True)', 'default': 'uuid4'}), '(UUID, primary_key=True, default=uuid4)\n', (1186, 1225), False, 'from sqlalchemy import Index, Column, Text, Table, ForeignKey\n'), ((1237, 1265), 'sqlalchemy.Column', 'Column', (['Text'], {'nullable': '(False)'}...
djemeljanovs/tfjs
tfjs-converter/python/tensorflowjs/converters/graph_rewrite_util.py
ee4430cd7a04283ec09184a3fe9d3fb27496f1dc
# 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
[((2048, 2085), 'tensorflow.python.framework.tensor_util.MakeNdarray', 'tensor_util.MakeNdarray', (['input_tensor'], {}), '(input_tensor)\n', (2071, 2085), False, 'from tensorflow.python.framework import tensor_util\n'), ((2499, 2533), 're.search', 're.search', (['"""(.*):\\\\d+$"""', 'node_name'], {}), "('(.*):\\\\d+$...
apple/ml-cvnets
loss_fn/classification_loss_fns/binary_cross_entropy.py
84d992f413e52c0468f86d23196efd9dad885e6f
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # from torch.nn import functional as F from torch import Tensor import argparse from . import register_classification_loss_fn from .. import BaseCriteria @register_classification_loss_fn(name="binary_cross_entropy"...
[((682, 733), 'torch.nn.functional.one_hot', 'F.one_hot', (['target'], {'num_classes': 'prediction.shape[-1]'}), '(target, num_classes=prediction.shape[-1])\n', (691, 733), True, 'from torch.nn import functional as F\n')]
lakshyarawal/pythonPractice
Sorting/insertion_sort.py
4b400342198a8270c5ac0c6306afb555f927c6c1
""" Insertion Sort Algorithm:""" """Implementation""" def insertion_sort(arr) -> list: n = len(arr) for i in range(1, n): swap_index = i for j in range(i-1, -1, -1): if arr[swap_index] < arr[j]: arr[swap_index], arr[j] = arr[j], arr[swap_index] swa...
[]
felixsc1/nipype
nipype/interfaces/spm/__init__.py
e722d6170593583f16ddfcb95473e5d30b5f1d7c
# -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Top-level namespace for spm.""" from .base import (Info, SPMCommand, logger, no_spm, scans_for_fname, scans_for_fnames) from .preprocess import (FieldMap, Slic...
[]
tobloef/neural-network
network.py
bd05a8b9eccc0f5a973782247d39f9b5aa33156c
import numpy as np from mathUtils import * class Network(object): """ Model for a feedforward Neural Network that use backpropagation with stochastic gradient decent. """ def __init__(self, layerSizes, biasVectors, weightMatrices): """ Initialise the network with a list of layer sizes ...
[((2883, 2906), 'numpy.random.shuffle', 'np.random.shuffle', (['data'], {}), '(data)\n', (2900, 2906), True, 'import numpy as np\n'), ((8137, 8155), 'numpy.argmax', 'np.argmax', (['outputs'], {}), '(outputs)\n', (8146, 8155), True, 'import numpy as np\n'), ((1345, 1369), 'numpy.random.randn', 'np.random.randn', (['size...
phixMe/marquez
examples/airflow/dags/etl_orders_7_days.py
06d71635369893b371a8a9c9e7023f11d7cbb1f8
from datetime import datetime from marquez_airflow import DAG from airflow.operators.postgres_operator import PostgresOperator from airflow.utils.dates import days_ago default_args = { 'owner': 'datascience', 'depends_on_past': False, 'start_date': days_ago(1), 'email_on_failure': False, 'email_on_...
[((385, 533), 'marquez_airflow.DAG', 'DAG', (['"""etl_orders_7_days"""'], {'schedule_interval': '"""@hourly"""', 'catchup': '(False)', 'default_args': 'default_args', 'description': '"""Loads newly placed orders weekly."""'}), "('etl_orders_7_days', schedule_interval='@hourly', catchup=False,\n default_args=default_...
marianarmorgado/python-starter
sample/pizza.py
8bf3d7a16fd462cf99898c9a82c6e1cf4fc0e7f2
# store information about a pizza being ordered pizza = { 'crust': 'thick', 'toppings': ['mushrooms', 'extra vegan cheese'] } # summarize the order print("You ordered a " + pizza['crust'] + "-crust pizza" + "with the following toppings:") for topping in pizza['toppings']: print("\t" + topping)
[]
Fh-Shadow/Progamando
YouTube/CursoEmVideo/python/ex012.py
f496d83c36e9a079ed06b4e7c34396c57f539de9
a = float(input('Qual Γ© o preΓ§o do produto? R$')) d = a - (a * 23 / 100) print('O produto que custava R${:.2f}, na promoΓ§Γ£o de 23% de desconto vai custar: R${:.2f}' .format(a, d))
[]
gperdrizet/gansformer
dnnlib/submission/submit.py
c68ba623aa498c83d8df4c4f0a3b5e3f63c773a5
# Submit a function to be run either locally or in a computing cluster. # Compared to original StyleGAN implementation, we extend the support for automatic training resumption, # and network recompilation. import copy import inspect import os import pathlib import pickle import platform import pprint import re import s...
[((6586, 6636), 'os.path.join', 'os.path.join', (['dnnlib.submit_config.run_dir', '*paths'], {}), '(dnnlib.submit_config.run_dir, *paths)\n', (6598, 6636), False, 'import os\n'), ((6974, 7024), 'os.path.join', 'os.path.join', (['run_dir_root', 'submit_config.run_name'], {}), '(run_dir_root, submit_config.run_name)\n', ...
zilong305/pycharts
pyecharts/custom/grid.py
6cf1bb7f17001a36da6a766615a78b1dbef5918f
#!/usr/bin/env python # coding=utf-8 from pyecharts.option import grid class Grid(object): def __init__(self): self._chart = None self._js_dependencies = set() def add(self, chart, grid_width=None, grid_height=None, grid_top=None, grid_bottom=...
[((3936, 3970), 'pprint.pprint', 'pprint.pprint', (['self._chart._option'], {}), '(self._chart._option)\n', (3949, 3970), False, 'import pprint\n'), ((1267, 1342), 'pyecharts.option.grid', 'grid', (['grid_width', 'grid_height', 'grid_top', 'grid_bottom', 'grid_left', 'grid_right'], {}), '(grid_width, grid_height, grid_...
devinmcgloin/smooch
smooch/conversations.py
c9561c3e7f1546efc58daa472b70f738d0d35e13
import logging from .endpoint import ask def send_message(user_id, message, sent_by_maker=True): if not valid_args(user_id, message): logging.warning("send message called with invalid args user_id={} message={}".format(user_id, message)) return logging.debug("Sending message: user_id={0} mes...
[]
Sharkbyteprojects/IRIS-ML_and_Deep-Learning
cifar/evalit.py
f0e053cf7a0e69019bbba36e6da3e60d76105fe9
import keras from keras.models import load_model from PIL import Image import matplotlib.pylab as plt import numpy as np import zipfile print("Extract") zip_ref = zipfile.ZipFile("./asset.zip", 'r') zip_ref.extractall(".") zip_ref.close() print("Load Model") model=load_model("cifar-model.h5") CIFAR_10_CLASSES=["Plane",...
[((163, 198), 'zipfile.ZipFile', 'zipfile.ZipFile', (['"""./asset.zip"""', '"""r"""'], {}), "('./asset.zip', 'r')\n", (178, 198), False, 'import zipfile\n'), ((265, 293), 'keras.models.load_model', 'load_model', (['"""cifar-model.h5"""'], {}), "('cifar-model.h5')\n", (275, 293), False, 'from keras.models import load_mo...
samiksha-patil/Knowledge-Sharing-Platform
tt/urls.py
22e61a659d5ad63fe656fa639dc897cbdebad4fe
""" tt URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based vi...
[((1026, 1057), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (1030, 1057), False, 'from django.urls import path, include\n'), ((1099, 1154), 'django.urls.path', 'path', (['"""register/"""', 'user_views.register'], {'name': '"""register"""'}), "('register/', use...
danihodovic/dht
src/git/cmd.py
636f54d70f8c6ca60ab48f2815b3e9e1a336d78f
import os import click os.environ["GIT_PYTHON_REFRESH"] = "quiet" @click.group() def git(): pass
[((71, 84), 'click.group', 'click.group', ([], {}), '()\n', (82, 84), False, 'import click\n')]
Tymec/Playground
TwitterImage2JPG.py
5a4aaa4a88e084d8d31803485b1ec521ad49a3d1
import glob import os def main(): os.chdir("F:/Downloads") extensions = ["*.jpg_large", "*.png_large", "*.jpg_orig"] file_list = list() for extension in extensions: file_list = file_list + glob.glob(extension) for file in file_list: for extension in extensions: new_ex...
[((40, 64), 'os.chdir', 'os.chdir', (['"""F:/Downloads"""'], {}), "('F:/Downloads')\n", (48, 64), False, 'import os\n'), ((216, 236), 'glob.glob', 'glob.glob', (['extension'], {}), '(extension)\n', (225, 236), False, 'import glob\n'), ((486, 511), 'os.rename', 'os.rename', (['file', 'new_name'], {}), '(file, new_name)\...
Riccardo95Facchini/DIL-2019
Data Analysis/classification.py
febeda55fd647943a1b8c49b3c5192fcd69fdaf5
import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from sklearn.metrics import classification_report #EVERY TIME THE DATASET IS RETRIEVED FROM GITHUB input_file = 'https://raw.githubusercontent.com/lcphy/Digital-Innovation-Lab/master/bank-full.csv' dataset = pd.read_csv(input...
[((303, 345), 'pandas.read_csv', 'pd.read_csv', (['input_file'], {'sep': '""";"""', 'header': '(0)'}), "(input_file, sep=';', header=0)\n", (314, 345), True, 'import pandas as pd\n'), ((1356, 1384), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(12, 10)'}), '(figsize=(12, 10))\n', (1366, 1384), True, 'imp...
anastasiia-zolochevska/cloud-custodian
tools/c7n_azure/tests/test_route_table.py
f25315a01bec808c16ab0e2d433d6151cf5769e4
# Copyright 2015-2018 Capital One Services, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
[((1248, 1289), 'azure_common.arm_template', 'arm_template', (['"""route-table-and-vnet.json"""'], {}), "('route-table-and-vnet.json')\n", (1260, 1289), False, 'from azure_common import BaseTest, arm_template\n'), ((1812, 1853), 'azure_common.arm_template', 'arm_template', (['"""route-table-and-vnet.json"""'], {}), "('...
pkthein/sparts_all_fam
proto/tp_artifact_1.0/build/lib/sawtooth_artifact/processor/handler.py
ff162e4ea8c3919a197dc0cc13fde6b32da113c7
# Copyright 2016 Intel Corporation # Copyright 2017 Wind River # 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 applica...
[((1207, 1234), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1224, 1234), False, 'import logging\n'), ((10040, 10085), 'sawtooth_sdk.processor.exceptions.InvalidTransaction', 'InvalidTransaction', (['"""Artifact ID is required"""'], {}), "('Artifact ID is required')\n", (10058, 10085),...
fsandx/moodybooks
ReviewsCollector.py
5c13fe43849e4fa861a163c74411e9f796518bc9
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ STEP 2 Takes the list of urls in the json files and downloads the html files to local drive Start with: scrapy runspider ReviewsCollector.py """ import scrapy import json class ReviewsCollector(scrapy.Spider): def start_requests(self): with open("data/b...
[((362, 374), 'json.load', 'json.load', (['f'], {}), '(f)\n', (371, 374), False, 'import json\n'), ((482, 585), 'scrapy.Request', 'scrapy.Request', ([], {'url': "item['url']", 'headers': "{'Referer': 'http://www.google.com/'}", 'callback': 'self.parse'}), "(url=item['url'], headers={'Referer':\n 'http://www.google.c...
roshie548/firelight
firelight/interfaces/light.py
3a5af5e2a1e5784127baebcf1517ffddcaff4062
from abc import ABC, abstractmethod from .color import Color class LightSystem(ABC): @classmethod def __subclasshook__(cls, subclass): return (hasattr(subclass, 'set_transition_time') and callable(subclass.set_transition_time) and hasattr(subclass, 'discover_lights') ...
[]
cadeng23/oop-cjgustafson
PolymorphismPYTHON/Polypy.py
cd3e5ca0e37f8b00a80516c6c8d5d6789a77d9a8
import random class Family: def __init__(self,first, last, hair): self.first = first self.last = last self.hair = hair def fullname(self): return '{} {}'.format(self.first,self.last) def eyefind(self): temp = random.choice([1,2]) #using the punnet square...
[((267, 288), 'random.choice', 'random.choice', (['[1, 2]'], {}), '([1, 2])\n', (280, 288), False, 'import random\n')]
evancohen/home-assistant
homeassistant/components/device_tracker/owntracks.py
dafc0ced6b07025c03417d8e7a2c0133b4c622fc
""" homeassistant.components.device_tracker.owntracks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ OwnTracks platform for the device tracker. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/device_tracker.owntracks/ """ import json import logging im...
[((1410, 1476), 'homeassistant.components.mqtt.subscribe', 'mqtt.subscribe', (['hass', 'LOCATION_TOPIC', 'owntracks_location_update', '(1)'], {}), '(hass, LOCATION_TOPIC, owntracks_location_update, 1)\n', (1424, 1476), True, 'import homeassistant.components.mqtt as mqtt\n'), ((731, 750), 'json.loads', 'json.loads', (['...
luyaojie/E3C
src/models/end_to_end_event_coreference.py
4b2f33da4629211fd6a3738077794f821c7f7c8b
#!/usr/bin/env python # -*- coding:utf-8 -*- # Created by Roger on 2019-09-10 # Mostly by AllenNLP import logging import math from typing import Any, Dict, List, Optional, Tuple import torch import torch.nn.functional as F from allennlp.data import Vocabulary from allennlp.models.model import Model from allennlp.mod...
[((1105, 1132), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1122, 1132), False, 'import logging\n'), ((1168, 1214), 'allennlp.models.model.Model.register', 'Model.register', (['"""end-to-end-event-coreference"""'], {}), "('end-to-end-event-coreference')\n", (1182, 1214), False, 'from ...
vietanhtran2710/ArtificialIntelligenceHomework
week2/7litersProblem.py
f4da761016d67477b50856cadf1e2560230d3f79
""" Given 3 bottles of capacities 3, 5, and 9 liters, count number of all possible solutions to get 7 liters """ current_path = [[0, 0, 0]] CAPACITIES = (3, 5, 9) solutions_count = 0 def move_to_new_state(current_state): global solutions_count, current_path if 7 in current_state: solutions_co...
[]
avezraj/st2
st2common/st2common/bootstrap/rulesregistrar.py
519c7f6819e52fb289c440bb7d1df7b558bb9ed7
# Copyright 2019 Extreme Networks, 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 at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
[((1275, 1302), 'st2common.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1292, 1302), True, 'from st2common import log as logging\n'), ((1804, 1826), 'six.iteritems', 'six.iteritems', (['content'], {}), '(content)\n', (1817, 1826), False, 'import six\n'), ((2716, 2739), 'os.path.split', 'os....
aiven/azure-sdk-for-python
sdk/costmanagement/azure-mgmt-costmanagement/azure/mgmt/costmanagement/models/_models_py3.py
8764dc07423beca46ed0b51212d81289d9e52c60
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
[]
jayvdb/brotlipy
test/test_simple_compression.py
ffddf2ea5adc584c8c353d246bb1077b7e781b63
# -*- coding: utf-8 -*- """ test_simple_compression ~~~~~~~~~~~~~~~~~~~~~~~~~ Tests for compression of single chunks. """ import brotli import pytest from hypothesis import given from hypothesis.strategies import binary, integers, sampled_from, one_of def test_roundtrip_compression_with_files(simple_compressed_fil...
[((3506, 3608), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""params"""', "[{'mode': 52}, {'quality': 52}, {'lgwin': 52}, {'lgblock': 52}]"], {}), "('params', [{'mode': 52}, {'quality': 52}, {'lgwin':\n 52}, {'lgblock': 52}])\n", (3529, 3608), False, 'import pytest\n'), ((3655, 3725), 'pytest.mark.para...
madmis/wexapi
wexapi/models/ticker.py
f5b1b9b566f767bca7d8fad1f08c3d1bca42355a
from decimal import Decimal class Ticker(object): def __init__( self, high: float, low: float, avg: float, vol: float, vol_cur: int, last: float, buy: float, sell: float, updated: int, ): ...
[((692, 706), 'decimal.Decimal', 'Decimal', (['value'], {}), '(value)\n', (699, 706), False, 'from decimal import Decimal\n'), ((847, 861), 'decimal.Decimal', 'Decimal', (['value'], {}), '(value)\n', (854, 861), False, 'from decimal import Decimal\n'), ((1002, 1016), 'decimal.Decimal', 'Decimal', (['value'], {}), '(val...
jjhenkel/dockerizeme
hard-gists/98bb452dc14e8c40e403/snippet.py
eaa4fe5366f6b9adf74399eab01c712cacaeb279
from scryptos import * p1 = 32581479300404876772405716877547 p2 = 27038194053540661979045656526063 p3 = 26440615366395242196516853423447 n = p1*p2*p3 e = 3 c = int(open("flag.enc", "rb").read().encode("hex"), 16) # from User's Guide to PARI/GP, nth_root function sqrtnall = 'sqrtnall(x,n)={my(V,r,z,r2);r=sqrtn(x,n,&z...
[]
ccsreenidhin/Music-Web-Django
musa/migrations/0001_initial.py
9b8286914f9099b9ed56c712c7ca384846f189d1
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-03-29 06:43 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion import musa.models class Migration(migrations.Migration): initial = True dependencies = [...
[((329, 386), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (360, 386), False, 'from django.db import migrations, models\n'), ((526, 619), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)...
RESP3CT88/Nuitka
nuitka/codegen/LoopCodes.py
0fcc25d9f00c4fc78c79a863c4b7987f573962e1
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com # # Part of "Nuitka", an optimizing Python compiler that is compatible and # integrates with CPython, but also works on its own. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complianc...
[]
L4mborg1n1-D14610/Algoritms_and_DataStructure
3_module/C_BloomFilter.py
f61b7434dbc600da02e8ec38648fa84beb160f17
import math from sys import exit # ΠΈΡ‚Π°ΠΊ, n - ΠΏΡ€ΠΈΠ±Π»ΠΈΠ·ΠΈΡ‚Π΅Π»ΡŒΠ½ΠΎΠ΅ число элСмСнтов Π² массивС, P - Π²Π΅Ρ€ΠΎΡΡ‚Π½ΠΎΡΡ‚ΡŒ Π»ΠΎΠΆΠ½ΠΎΠΏΠΎΠ»ΠΎΠΆΠΈΡ‚Π΅Π»ΡŒΠ½ΠΎΠ³ΠΎ ΠΎΡ‚Π²Π΅Ρ‚Π°, Ρ‚ΠΎΠ³Π΄Π° Ρ€Π°Π·ΠΌΠ΅Ρ€ # структуры m = -(nlog2P) / ln2 (2 - основаниС), количСство Ρ…Π΅Ρˆ-Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΉ Π±ΡƒΠ΄Π΅Ρ‚ Ρ€Π°Π²Π½ΠΎ -log2P # Ρ…Π΅Ρˆ-Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΈ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΡŽΡ‚ΡΡ Π²ΠΈΠ΄Π°: (((i + 1)*x + p(i+1)) mod M) mod m,Π³Π΄Π΅ - x - ΠΊΠ»ΡŽΡ‡,...
[((4309, 4315), 'sys.exit', 'exit', ([], {}), '()\n', (4313, 4315), False, 'from sys import exit\n'), ((1048, 1067), 'math.ceil', 'math.ceil', (['(size / 8)'], {}), '(size / 8)\n', (1057, 1067), False, 'import math\n'), ((1830, 1842), 'math.log2', 'math.log2', (['p'], {}), '(p)\n', (1839, 1842), False, 'import math\n')...
Surfndez/source-publish
pyzmq/examples/pubsub/subscriber.py
c3838b303c1a0806f21cd4e8d8c207015b3ce9c8
"""A test that subscribes to NumPy arrays. Uses REQ/REP (on PUB/SUB socket + 1) to synchronize """ #----------------------------------------------------------------------------- # Copyright (c) 2010 Brian Granger # # Distributed under the terms of the New BSD License. The full license is in # the file COPYING.BSD...
[]
livioso/cpython
Doc/includes/sqlite3/load_extension.py
077061a7b24917aaf31057885c69919c5a553c88
import sqlite3 con = sqlite3.connect(":memory:") # enable extension loading con.enable_load_extension(True) # Load the fulltext search extension con.execute("select load_extension('./fts3.so')") # alternatively you can load the extension using an API call: # con.load_extension("./fts3.so") # disable extension load...
[((22, 49), 'sqlite3.connect', 'sqlite3.connect', (['""":memory:"""'], {}), "(':memory:')\n", (37, 49), False, 'import sqlite3\n')]
RunzheYang/lingvo
lingvo/core/inference_graph_exporter.py
1291e29812f9ee9836f9cacbb05db9ec6b095234
# Lint as: python3 # Copyright 2018 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 ...
[((1968, 2135), 'collections.namedtuple', 'collections.namedtuple', (['"""InferenceDeviceOptions"""', "['device', 'retain_device_placement', 'var_options', 'gen_init_op',\n 'dtype_override', 'fprop_dtype_override']"], {}), "('InferenceDeviceOptions', ['device',\n 'retain_device_placement', 'var_options', 'gen_ini...
VijayKalmath/USCrimeAnalysis
src/preprocessing/annual_hc_by_crime_loc.py
14c96aae52547a4f7ea140395c62a621a97def50
#! usr/env/bin python import glob import numpy as np import pandas as pd from tqdm import tqdm def main(): # Fetch File Paths file_paths = glob.glob(r'./data/raw/ucr/hc_count_by_place/*.xls') # Sort them according to year file_paths.sort(key = lambda x: int(x[-8:-4])) # Create a result dataframe ...
[((150, 201), 'glob.glob', 'glob.glob', (['"""./data/raw/ucr/hc_count_by_place/*.xls"""'], {}), "('./data/raw/ucr/hc_count_by_place/*.xls')\n", (159, 201), False, 'import glob\n'), ((442, 462), 'tqdm.tqdm', 'tqdm', (['file_paths[1:]'], {}), '(file_paths[1:])\n', (446, 462), False, 'from tqdm import tqdm\n'), ((524, 573...
ethanjperez/allennlp
allennlp/tests/modules/token_embedders/bag_of_word_counts_token_embedder_test.py
e520993f16f0da7e2c40f6e44b8dc56338f46b57
# pylint: disable=no-self-use,invalid-name import numpy as np from numpy.testing import assert_almost_equal import torch from allennlp.common import Params from allennlp.data import Vocabulary from allennlp.modules.token_embedders import BagOfWordCountsTokenEmbedder from allennlp.common.testing import AllenNlpTestCase ...
[((484, 496), 'allennlp.data.Vocabulary', 'Vocabulary', ([], {}), '()\n', (494, 496), False, 'from allennlp.data import Vocabulary\n'), ((755, 765), 'allennlp.common.Params', 'Params', (['{}'], {}), '({})\n', (761, 765), False, 'from allennlp.common import Params\n'), ((785, 852), 'allennlp.modules.token_embedders.BagO...
hengkaiz/meshrcnn
demo/demo_shapenet.py
eb5b5bc0639a33e48f0fc1e0834106798cd1e3d8
import argparse import logging import multiprocessing as mp import logging import os from detectron2.evaluation import inference_context import torch import torch.distributed as dist import torch.multiprocessing as mp from detectron2.utils.collect_env import collect_env_info from detectron2.utils.logger import setup_lo...
[((840, 865), 'logging.getLogger', 'logging.getLogger', (['"""demo"""'], {}), "('demo')\n", (857, 865), False, 'import logging\n'), ((899, 917), 'shapenet.config.config.get_shapenet_cfg', 'get_shapenet_cfg', ([], {}), '()\n', (915, 917), False, 'from shapenet.config.config import get_shapenet_cfg\n'), ((1059, 1111), 'a...
jshin13/progressive-learning
proglearn/voters.py
dccc70fe5f6a03d2c53c2b01fd2122d7fd2798dc
import numpy as np # from sklearn.ensemble import BaggingClassifier # from sklearn.tree import DecisionTreeClassifier from sklearn.neighbors import KNeighborsClassifier from sklearn.utils.validation import ( check_X_y, check_array, NotFittedError, ) from sklearn.utils.multiclass import check_classificati...
[((795, 826), 'sklearn.utils.multiclass.check_classification_targets', 'check_classification_targets', (['y'], {}), '(y)\n', (823, 826), False, 'from sklearn.utils.multiclass import check_classification_targets, type_of_target\n'), ((1176, 1188), 'numpy.unique', 'np.unique', (['X'], {}), '(X)\n', (1185, 1188), True, 'i...
jhattat/photoBooth
config.py
f6fe3ab418bb917792e10349597401ed34078766
# Tumblr Setup # Replace the values with your information # OAuth keys can be generated from https://api.tumblr.com/console/calls/user/info consumer_key='ShbOqI5zErQXOL7Qnd5XduXpY9XQUlBgJDpCLeq1OYqnY2KzSt' #replace with your key consumer_secret='ulZradkbJGksjpl2MMlshAfJgEW6TNeSdZucykqeTp8jvwgnhu' #replace with your sec...
[]
GuilhemN/site-interludes
accounts/admin.py
69873810d5b0168aa57277ba51805117e6c53874
from django.contrib import admin from django.contrib.auth.models import Group from accounts.models import EmailUser from shared.admin import ExportCsvMixin # no need for groups - we only have regular users and superusers admin.site.unregister(Group) @admin.register(EmailUser) class EmailUserAdmin(ExportCsvMixin, adm...
[((223, 251), 'django.contrib.admin.site.unregister', 'admin.site.unregister', (['Group'], {}), '(Group)\n', (244, 251), False, 'from django.contrib import admin\n'), ((254, 279), 'django.contrib.admin.register', 'admin.register', (['EmailUser'], {}), '(EmailUser)\n', (268, 279), False, 'from django.contrib import admi...
vnavascues/rotki
rotkehlchen/exchanges/coinbase.py
8675bdb02bf84bfccb5d59362e3ae2b7138fcd8f
import hashlib import hmac import logging import time from json.decoder import JSONDecodeError from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple from urllib.parse import urlencode import requests from rotkehlchen.assets.asset import Asset from rotkehlchen.assets.converters import asset_from_coinbase ...
[((1478, 1505), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1495, 1505), False, 'import logging\n'), ((1512, 1542), 'rotkehlchen.logging.RotkehlchenLogsAdapter', 'RotkehlchenLogsAdapter', (['logger'], {}), '(logger)\n', (1534, 1542), False, 'from rotkehlchen.logging import Rotkehlchen...
aonrobot/MSC-thug-auth-provider
lib/python3.7/site-packages/ldap/controls/deref.py
aef37ef5a000586b8502cc536244f31e08b9c2db
# -*- coding: utf-8 -*- """ ldap.controls.deref - classes for (see https://tools.ietf.org/html/draft-masarati-ldap-deref) See https://www.python-ldap.org/ for project details. """ __all__ = [ 'DEREF_CONTROL_OID', 'DereferenceControl', ] import ldap.controls from ldap.controls import LDAPControl,KNOWN_RESPONSE_CO...
[((1235, 1251), 'pyasn1_modules.rfc2251.AttributeValue', 'AttributeValue', ([], {}), '()\n', (1249, 1251), False, 'from pyasn1_modules.rfc2251 import LDAPDN, AttributeDescription, AttributeDescriptionList, AttributeValue\n'), ((1581, 1638), 'pyasn1.type.tag.Tag', 'tag.Tag', (['tag.tagClassContext', 'tag.tagFormatConstr...
notagoat/Deepmoji
emoji.py
1ab922306c3647f9c7ea98caa2660a53b18fe4b6
import requests import urllib.request import os.path import shutil import csv def main(): with open("data.csv") as i: #Open the data.csv file instances = i.readlines() #Write them into memory instances = [x.strip() for x in instances] #Strip any weird issues from writing instances.sort() #Sort t...
[((1115, 1191), 'requests.get', 'requests.get', (["('https://%s/api/v1/custom_emojis' % name)"], {'allow_redirects': '(True)'}), "('https://%s/api/v1/custom_emojis' % name, allow_redirects=True)\n", (1127, 1191), False, 'import requests\n'), ((2940, 2989), 'shutil.copyfile', 'shutil.copyfile', (['(path + name)', "('emo...
Zhenye-Na/LxxxCode
String/640.One Edit Distance/Solution_DP.py
afd79d790d0a7495d75e6650f80adaa99bd0ff07
class Solution: """ @param s: a string @param t: a string @return: true if they are both one edit distance apart or false """ def isOneEditDistance(self, s, t): # write your code here if s == t: return False if abs(len(s) - len(t)) > 1: return Fal...
[]
jehiah/pynsq
nsq/__init__.py
899b60a8ce77ed6c8ab899fbdfd7adbc1b450c96
from __future__ import absolute_import import signal import tornado.ioloop import logging from .protocol import ( Error, unpack_response, decode_message, valid_topic_name, valid_channel_name, identify, subscribe, ready, finish, touch, requeue, nop, pub, mpub, ...
[]
Hespian/ParFastKer
scripts/summaryPlot.py
5ddf1685c0652e73c889cfc64c7ec1fd827f905c
import get_data_ours import get_data_akiba import get_data_NearLinear import get_data_LinearTime import os import matplotlib.pyplot as plt # graphs = ["uk-2002", "arabic-2005", "gsh-2015-tpd", "uk-2005", "it-2004", "sk-2005", "uk-2007-05", "webbase-2001", "asia.osm", "road_usa", "europe.osm", "rgg_n26_s0", "RHG-10000...
[((4378, 4401), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'size': '(14)'}), "('font', size=14)\n", (4384, 4401), True, 'import matplotlib.pyplot as plt\n'), ((4408, 4438), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(3.2, 2.4)'}), '(figsize=(3.2, 2.4))\n', (4418, 4438), True, 'import matplotli...
lrnt/git-bouncer
bouncer/cli/base.py
3015e11a5d2c90986124de73bf1fd0f5a8563360
import configparser import sys import inspect from argparse import ArgumentParser, RawDescriptionHelpFormatter def opt(*args, **kwargs): def decorator(method): if not hasattr(method, 'options'): method.options = [] method.options.append((args, kwargs)) return method return...
[((1896, 2005), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'prog': 'prog', 'description': "(method.__doc__ or '')", 'formatter_class': 'RawDescriptionHelpFormatter'}), "(prog=prog, description=method.__doc__ or '', formatter_class\n =RawDescriptionHelpFormatter)\n", (1910, 2005), False, 'from argparse import...
MahdadJafarzadeh/ssccoorriinngg
Examples/ExampleCodes_ssccoorriinngg.py
63c726e9e7d0f6d13032415c76b8c3bb1ff2bee3
#%% Import libs import numpy as np from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import cross_validate from sklearn.metrics import make_scorer, accuracy_score, precision_score, recall_score, f1_score import h5py import time from ssccoorriinngg import ssccoorriinngg import numpy as np ...
[((442, 495), 'ssccoorriinngg.ssccoorriinngg', 'ssccoorriinngg', ([], {'filename': '""""""', 'channel': '""""""', 'fs': '(200)', 'T': '(30)'}), "(filename='', channel='', fs=200, T=30)\n", (456, 495), False, 'from ssccoorriinngg import ssccoorriinngg\n'), ((6783, 6794), 'time.time', 'time.time', ([], {}), '()\n', (6792...
suresh-guttikonda/iGibson
igibson/examples/behavior/behavior_demo_collection.py
a69e623058180146466cd52d4bb3c00d1facdacf
""" Main BEHAVIOR demo collection entrypoint """ import argparse import copy import datetime import os import bddl import numpy as np import igibson from igibson.activity.activity_base import iGBEHAVIORActivityInstance from igibson.render.mesh_renderer.mesh_renderer_cpu import MeshRendererSettings from igibson.rende...
[((1003, 1070), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run and collect an ATUS demo"""'}), "(description='Run and collect an ATUS demo')\n", (1026, 1070), False, 'import argparse\n'), ((2343, 2370), 'bddl.set_backend', 'bddl.set_backend', (['"""iGibson"""'], {}), "('iGibson')\n",...
digitalmarmalade/wagtail
wagtail/wagtailadmin/menu.py
ac4d23172ff3f42746625630583b17d243fb9822
from django.utils.text import slugify from django.utils.html import format_html class MenuItem(object): def __init__(self, label, url, name=None, classnames='', order=1000): self.label = label self.url = url self.classnames = classnames self.name = (name or slugify(unicode(label)))...
[((391, 520), 'django.utils.html.format_html', 'format_html', (['u"""<li class="menu-{0}"><a href="{1}" class="{2}">{3}</a></li>"""', 'self.name', 'self.url', 'self.classnames', 'self.label'], {}), '(u\'<li class="menu-{0}"><a href="{1}" class="{2}">{3}</a></li>\',\n self.name, self.url, self.classnames, self.label)...
timgates42/django-mfa
django_mfa/migrations/0001_initial.py
89eeb83f7da3ea24f205b40b13c7f9d33ea15b99
# Generated by Django 2.1.5 on 2019-03-26 11:35 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] ope...
[((247, 304), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (278, 304), False, 'from django.db import migrations, models\n'), ((435, 528), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)...
khanh-nguyen-code/my-collection
app/logger_example/main.py
31581ef0b1dae67aafb1f4e64b9973a38cc01edf
from my_collection import logger if __name__ == "__main__": logger.now().debug("debug1") logger.now().debug("debug2") logger.now().info("hello1") logger.now().info("hello2") logger.now().with_field("key", "val").error("with field1") logger.now().with_field("key", "val").error("with field2")
[((65, 77), 'my_collection.logger.now', 'logger.now', ([], {}), '()\n', (75, 77), False, 'from my_collection import logger\n'), ((98, 110), 'my_collection.logger.now', 'logger.now', ([], {}), '()\n', (108, 110), False, 'from my_collection import logger\n'), ((131, 143), 'my_collection.logger.now', 'logger.now', ([], {}...
scathaig/robotframework-iperf3
robotframework_iperf3/__main__.py
cfeeb3e265777403d7eb06fcfa6d69650f2a5e67
import argparse from robotremoteserver import RobotRemoteServer from .iperf3 import Iperf3 if __name__ == '__main__': # create commandline parser parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.prog = 'python3 -m robotframework_iperf3' # add parser opt...
[((166, 245), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n', (189, 245), False, 'import argparse\n')]
ahmedengu/h2o-3
h2o-docs/src/booklets/v2_2015/source/Python_Vignette_code_examples/python_combine_frames_append_one_as_columns.py
ac2c0a6fbe7f8e18078278bf8a7d3483d41aca11
df8.cbind(df9) # A B C D A0 B0 C0 D0 # ----- ------ ------ ------ ------ ----- ----- ----- # -0.09 0.944 0.160 0.271 -0.351 1.66 -2.32 -0.86 # -0.95 0.669 0.664 1.535 -0.633 -1.78 0.32 1.27 # 0.17 0.657 0.970 -0.419 -1.413 -0.51 0.64 -1.25 # 0.58 -0.516 -1.598 -1.346 0.71...
[]
xu6148152/Binea_Python_Project
FluentPython/dynamic_attr_and_prop/frozen_json.py
d943eb5f4685d08f080b372dcf1a7cbd5d63efed
#!/usr/bin/env python3 # -*- encoding: utf-8 -*- from collections import abc from keyword import iskeyword class FronzenJSON: def __init__(self, mapping): self._data = {} for key, value in mapping.items(): if iskeyword(key): key += '_' # self._data = di...
[((244, 258), 'keyword.iskeyword', 'iskeyword', (['key'], {}), '(key)\n', (253, 258), False, 'from keyword import iskeyword\n')]
Semanti1/pomdp_findit
pomdp_problems/tag/models/transition_model.py
b96c1c06aab4b485fa005654cf6438ff63718083
"""The Tag problem. Implemented according to the paper `Anytime Point-Based Approximations for Large POMDPs <https://arxiv.org/pdf/1110.0027.pdf>`_. Transition model: the robot moves deterministically. The target's movement depends on the robot; With Pr=0.8 the target moves away from the robot, and with P...
[((2636, 2656), 'copy.deepcopy', 'copy.deepcopy', (['state'], {}), '(state)\n', (2649, 2656), False, 'import copy\n')]
bocekm/packit
packit/fedpkg.py
b5da23c0fa3f205537551b9ed212d8f77d00d705
# MIT License # # Copyright (c) 2019 Red Hat, Inc. # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge,...
[((2133, 2287), 'packit.utils.commands.run_command_remote', 'commands.run_command_remote', ([], {'cmd': "[self.fedpkg_exec, 'new-sources', sources]", 'cwd': 'self.directory', 'error_message': '"""Adding new sources failed:"""', 'fail': 'fail'}), "(cmd=[self.fedpkg_exec, 'new-sources', sources],\n cwd=self.directory,...
ahaldane/NDducktype_tests
tests/test_MaskedArrayCollection.py
4876416e5fbff7ba0d85445c0eeae432d6e80014
#!/usr/bin/env python from ndarray_ducktypes.ArrayCollection import ArrayCollection from ndarray_ducktypes.MaskedArray import MaskedArray from ndarray_ducktypes.MaskedArrayCollection import MaskedArrayCollection import numpy as np # Tests for Masked ArrayCollections. # # First try: Simply make an arraycollection of Ma...
[]
jasonjoo2010/core
rpc/gen/core_pb2.py
7c05ddbdac2e05a3d96db28f8bdfacf661907b82
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: core.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflecti...
[((477, 503), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (501, 503), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((16870, 17180), 'google.protobuf.descriptor.Descriptor', '_descriptor.Descriptor', ([], {'name': '"""Empty"""', 'full_name': '""...
moevm/nosql1h19-text-graph
src/models/text_node.py
410f156ad4f232f8aa060d43692ab020610ddfd4
from neomodel import StructuredNode, StringProperty, JSONProperty, \ Relationship, IntegerProperty import numpy as np import re from models.text_relation import TextRelation __all__ = ['TextNode'] class TextNode(StructuredNode): order_id = IntegerProperty(required=True, unique_index=True) ...
[((270, 319), 'neomodel.IntegerProperty', 'IntegerProperty', ([], {'required': '(True)', 'unique_index': '(True)'}), '(required=True, unique_index=True)\n', (285, 319), False, 'from neomodel import StructuredNode, StringProperty, JSONProperty, Relationship, IntegerProperty\n'), ((332, 361), 'neomodel.StringProperty', '...
otaviocarvalho/chess-negamax
tests/test_bishop_generate.py
21f1066611e581dac3257d3f46c71ca2b09b5964
import unittest from .helpers import StubBoard, StubPiece, C, WHITE, BLACK class TestBishopGenerate(unittest.TestCase): def get_bishop(self, board, team, position): from chess.models import Bishop return Bishop(board, team, position) def compare_list(self, expected, results): compared ...
[((2640, 2655), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2653, 2655), False, 'import unittest\n'), ((225, 254), 'chess.models.Bishop', 'Bishop', (['board', 'team', 'position'], {}), '(board, team, position)\n', (231, 254), False, 'from chess.models import Bishop\n')]