repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
sheriffbarrow/production-ecommerce | src/production_ecommerce/account/models.py | cb1a29795ff8e9b4aa95a78df50bb8aa3e5f4350 | from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
class MyAccountManager(BaseUserManager):
def create_user(self, email, username, password=None):
if not email:
raise ValueError('Users must have an email address')
if not username:
raise ValueError('Users m... | [((833, 909), 'django.db.models.EmailField', 'models.EmailField', ([], {'verbose_name': '"""email address"""', 'max_length': '(255)', 'unique': '(True)'}), "(verbose_name='email address', max_length=255, unique=True)\n", (850, 909), False, 'from django.db import models\n'), ((919, 961), 'django.db.models.IntegerField',... |
fernandobrito/dbt-metabase | dbtmetabase/models/config.py | a1fa5a2c7c5e3cf12ead8806d39f6bd3a212fb83 | from dataclasses import dataclass, field
from typing import Optional, Iterable, Union
@dataclass
class MetabaseConfig:
# Metabase Client
database: str
host: str
user: str
password: str
# Metabase additional connection opts
use_http: bool = False
verify: Union[str, bool] = True
# Me... | [((624, 651), 'dataclasses.field', 'field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (629, 651), False, 'from dataclasses import dataclass, field\n'), ((677, 704), 'dataclasses.field', 'field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (682, 704), False, 'from dataclasses impo... |
arunksaha/heap_tracker | src/plot_timeseries_outstanding_bytes.py | 0755c6b9c3e4e621efda31c144421a1e67e51a9c | #
# Copyright 2018, Arun Saha <arunksaha@gmail.com>
#
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.dates as md
import datetime as dt
import sys
import os
# Open the file, read the string contents into a list,
# and return the list.
def GetLinesListFromFile(filename):
with open(filename) as f:
... | [] |
vmariano/meme-classifier | import.py | e8d6e73e4a843542143f20381c0741df16d3945d | from dotenv import load_dotenv
load_dotenv()
import sys
import os
import re
import json
import psycopg2
from meme_classifier.images import process_image
path = sys.argv[1]
data = json.load(open(os.path.join(path, 'result.json'), 'r'))
chat_id = data['id']
conn = psycopg2.connect(os.getenv('POSTGRES_CREDENTIALS'))
... | [((31, 44), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (42, 44), False, 'from dotenv import load_dotenv\n'), ((284, 317), 'os.getenv', 'os.getenv', (['"""POSTGRES_CREDENTIALS"""'], {}), "('POSTGRES_CREDENTIALS')\n", (293, 317), False, 'import os\n'), ((198, 231), 'os.path.join', 'os.path.join', (['path', '"... |
jak0203/nps-dash | nps/migrations/0013_auto_20180314_1805.py | 9a3bdb0e55e0c857bcce8ed8df04b52a2b71872f | # Generated by Django 2.0.3 on 2018-03-15 01:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('nps', '0012_auto_20180314_1600'),
]
operations = [
migrations.CreateModel(
name='ClientAggregations',
fields=[
... | [((1327, 1375), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""AggregatedResults"""'}), "(name='AggregatedResults')\n", (1349, 1375), False, 'from django.db import migrations, models\n'), ((1408, 1451), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""Prod... |
NoAnyLove/pydantic | docs/schema_mapping.py | 50fd2c5b48ffe611b5c4feb24f26f7202217faab | #!/usr/bin/env python3
"""
Build a table of Python / Pydantic to JSON Schema mappings.
Done like this rather than as a raw rst table to make future edits easier.
Please edit this file directly not .tmp_schema_mappings.rst
"""
table = [
[
'bool',
'boolean',
'',
'JSON Schema Core',
... | [] |
kevin2357/hubspot3 | hubspot3/test/test_broadcast.py | 488f6ff4195034317d99431439087443bca1469f | import time
import unittest
from nose.plugins.attrib import attr
from hubspot3.test import helper
from hubspot3.broadcast import Broadcast, BroadcastClient
class BroadcastClientTest(unittest.TestCase):
""" Unit tests for the HubSpot Broadcast API Python client.
This file contains some unittest tests for the ... | [((733, 744), 'nose.plugins.attrib.attr', 'attr', (['"""api"""'], {}), "('api')\n", (737, 744), False, 'from nose.plugins.attrib import attr\n'), ((1448, 1459), 'nose.plugins.attrib.attr', 'attr', (['"""api"""'], {}), "('api')\n", (1452, 1459), False, 'from nose.plugins.attrib import attr\n'), ((1648, 1659), 'nose.plug... |
theroggy/geofile_ops | benchmark/benchmarks/testdata.py | 1b5ab42169d5c3332c0d8298c5a036257cfd68d5 | # -*- coding: utf-8 -*-
"""
Module to prepare test data for benchmarking geo operations.
"""
import enum
import logging
from pathlib import Path
import pprint
import shutil
import sys
import tempfile
from typing import Optional
import urllib.request
import zipfile
# Add path so the benchmark packages are found
sys.pa... | [((596, 623), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (613, 623), False, 'import logging\n'), ((3020, 3029), 'pathlib.Path', 'Path', (['url'], {}), '(url)\n', (3024, 3029), False, 'from pathlib import Path\n'), ((1819, 1851), 'geofileops.get_layerinfo', 'gfo.get_layerinfo', (['test... |
ziyixi/SeisScripts | relocation/depth/setup_relocation_dir.py | a484bc1747eae52b2441f0bfd47ac7e093150f1d | """
setup earthquake depth relocation directory
"""
import obspy
import sh
import numpy as np
import click
from os.path import join
from glob import glob
import copy
def generate_new_cmtsolution_files(cmts_dir, generated_cmts_dir, depth_perturbation_list):
cmt_names = glob(join(cmts_dir, "*"))
for cmt_file i... | [((5319, 5334), 'click.command', 'click.command', ([], {}), '()\n', (5332, 5334), False, 'import click\n'), ((5336, 5426), 'click.option', 'click.option', (['"""--main_dir"""'], {'required': '(True)', 'help': '"""the main working directory"""', 'type': 'str'}), "('--main_dir', required=True, help='the main working dire... |
blbarker/atk | python-client/trustedanalytics/core/atktypes.py | bcb747d053e801820233a6439c88a457c8cf2438 | # vim: set encoding=utf-8
#
# Copyright (c) 2015 Intel Corporation
#
# 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 requi... | [((1489, 1523), 're.compile', 're.compile', (['"""^vector\\\\((\\\\d+)\\\\)$"""'], {}), "('^vector\\\\((\\\\d+)\\\\)$')\n", (1499, 1523), False, 'import re\n'), ((4993, 5021), 'dateutil.parser.parse', 'datetime_parser.parse', (['value'], {}), '(value)\n', (5014, 5021), True, 'import dateutil.parser as datetime_parser\n... |
poikilos/tabletopManualMiner | srd/pageaggregator.py | 94a824feabdf0a8efa1bf28670af44820aff9923 | #!/usr/bin/env python3
import math
try:
# from PDFPageDetailedAggregator:
from pdfminer.pdfdocument import PDFDocument, PDFNoOutlines
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import PDFPageAggregator
... | [((851, 866), 'srd.objDict', 'objDict', (['ltanno'], {}), '(ltanno)\n', (858, 866), False, 'from srd import objDict, BBox, DocChunk, clean_frag_text, clean_frag, same_style, frag_dict\n'), ((1782, 1857), 'pdfminer.converter.PDFPageAggregator.__init__', 'PDFPageAggregator.__init__', (['self', 'rsrcmgr'], {'pageno': 'pag... |
dkim286/cpsc454-proj | ctrltest.py | 16314802bae3cfbd4d1bf6d7f75a9e6adeb6700d | from pox.core import core
import pox.openflow.libopenflow_01 as of
from forwarding.l2_learning import *
from tkinter import *
from project.firewall import TestFW
from project.ui import UI
def setup():
top = Toplevel()
# quit POX when window is killed
top.protocol("WM_DELETE_WINDOW", core.quit)
t... | [((851, 902), 'pox.core.core.registerNew', 'core.registerNew', (['TestFW', 'fw_list_dpid[0]', 'srv_list'], {}), '(TestFW, fw_list_dpid[0], srv_list)\n', (867, 902), False, 'from pox.core import core\n'), ((954, 990), 'pox.core.core.registerNew', 'core.registerNew', (['l2_learning', '(False)'], {}), '(l2_learning, False... |
kenmutuma001/Blog | virtual/lib/python3.6/site-packages/mako/__init__.py | 6b19a77b71694bbe9f5e84207de46c68f87ebc5e | # mako/__init__.py
# Copyright (C) 2006-2016 the Mako authors and contributors <see AUTHORS file>
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
__version__ = '1.0.9'
| [] |
RangeKing/PaddleViT | image_classification/T2T_ViT/load_pytorch_weights.py | 0e25958686e04ed8872cf67fba0dfd6918e9b4dd | # Copyright (c) 2021 PPViT Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | [((7166, 7190), 'paddle.set_device', 'paddle.set_device', (['"""cpu"""'], {}), "('cpu')\n", (7183, 7190), False, 'import paddle\n'), ((8963, 8982), 't2t_vit.build_t2t_vit', 'build_model', (['config'], {}), '(config)\n', (8974, 8982), True, 'from t2t_vit import build_t2t_vit as build_model\n'), ((9178, 9197), 'torch.dev... |
j-bac/id-concentration | estimators/__init__.py | 372bacc846d3d5dd5f99178863fa214fb8d3b292 | from ._FisherS import randsphere, preprocessing, SeparabilityAnalysis, point_inseparability_to_pointID
from ._call_estimators import TwoNN, run_singleGMST,run_singleCorrDim,runDANCo, runDANCoStats, runDANColoop,runANOVAglobal,runANOVAlocal,radovanovic_estimators_matlab,Hidalgo
from ._DANCo import dancoDimEst as danco_p... | [] |
NeroAsmarr/fz-api | examples/get_message.py | d688277b4c616e93c809381ab082cba834964681 | # 获取调课、改课通知例子
from zfnew import GetInfo, Login
base_url = '学校教务系统的主页url'
lgn = Login(base_url=base_url)
lgn.login('账号', '密码')
cookies = lgn.cookies # cookies获取方法
person = GetInfo(base_url=base_url, cookies=cookies)
message = person.get_message()
print(message)
| [((82, 106), 'zfnew.Login', 'Login', ([], {'base_url': 'base_url'}), '(base_url=base_url)\n', (87, 106), False, 'from zfnew import GetInfo, Login\n'), ((175, 218), 'zfnew.GetInfo', 'GetInfo', ([], {'base_url': 'base_url', 'cookies': 'cookies'}), '(base_url=base_url, cookies=cookies)\n', (182, 218), False, 'from zfnew i... |
AtilioA/Sort-merge-join | input/gera_entradas.py | 6ed3199aada921973833cafffc8cbde5062b76fb | import sys
import random
from faker import Faker
def gera(nLinhas=100, nCampos=None):
with open(f"{path}/file{nLinhas}-{nCampos}_python.txt", "w+", encoding="utf8") as file:
if not nCampos:
nCampos = random.randint(2, 10)
camposFuncs = [
fake.name,
fake.date,
... | [((830, 844), 'faker.Faker', 'Faker', (['"""pt_BR"""'], {}), "('pt_BR')\n", (835, 844), False, 'from faker import Faker\n'), ((226, 247), 'random.randint', 'random.randint', (['(2)', '(10)'], {}), '(2, 10)\n', (240, 247), False, 'import random\n'), ((602, 627), 'random.randint', 'random.randint', (['(0)', '(999999)'], ... |
zainllw0w/skillbox | lessons 20/HomeWork/task9.py | 896287b6f7f5612cf589094131fd1a12b0b192ba | def sort(data, time):
tt = False
ft = True
st = False
is_find = True
winers_name = set()
index = 0
while is_find:
index += 1
for key, values in data.items():
if time[0 - index] == int(values[1]) and ft and values[0] not in winers_name:
first_id = k... | [] |
aiw-google/openweave-core | src/test-apps/happy/test-templates/WeaveInetDNS.py | 5dfb14b21d0898ef95bb62ff564cadfeea4b4702 | #!/usr/bin/env python
#
# Copyright (c) 2016-2017 Nest Labs, 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/lice... | [] |
ZezaoDev/Circtrigo | funcoes.py | 5e5f6be0bdee17d30c2993478ca25409b82b6af3 | import turtle as t
import math
class circTrigo:
def __init__(self):
self.raio = 0
self.grau = 0
self.seno = 0
self.cosseno = 0
self.tangente = 0
self.quadrante = 0
self.tema = ''
t.bgcolor("black")
t.pencolor("white")
def seta(s... | [((250, 268), 'turtle.bgcolor', 't.bgcolor', (['"""black"""'], {}), "('black')\n", (259, 268), True, 'import turtle as t\n'), ((277, 296), 'turtle.pencolor', 't.pencolor', (['"""white"""'], {}), "('white')\n", (287, 296), True, 'import turtle as t\n'), ((361, 371), 'turtle.left', 't.left', (['(90)'], {}), '(90)\n', (36... |
IniZio/py-skygear | examples/catapi/feeder.py | 88479678f91e678fd931c28295189bfea2148c79 | def pick_food(name):
if name == "chima":
return "chicken"
else:
return "dry food"
| [] |
crochereau/esm | esm/model.py | 881a3b924d3f74e3cddeb6929e91ee7224ef2ebd | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from .modules import (
TransformerLayer,
LearnedPosit... | [((1887, 1975), 'torch.nn.Embedding', 'nn.Embedding', (['self.alphabet_size', 'self.args.embed_dim'], {'padding_idx': 'self.padding_idx'}), '(self.alphabet_size, self.args.embed_dim, padding_idx=self.\n padding_idx)\n', (1899, 1975), True, 'import torch.nn as nn\n'), ((3156, 3186), 'math.sqrt', 'math.sqrt', (['self.... |
bfloch/tink | python/tink/aead/kms_envelope_aead.py | aac780590902f726a8e7d6c4e3aa1cd75f4b0ed5 | # Copyright 2020 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,... | [((1949, 1994), 'tink.core.Registry.new_key_data', 'core.Registry.new_key_data', (['self.key_template'], {}), '(self.key_template)\n', (1975, 1994), False, 'from tink import core\n'), ((2010, 2049), 'tink.core.Registry.primitive', 'core.Registry.primitive', (['dek', 'aead.Aead'], {}), '(dek, aead.Aead)\n', (2033, 2049)... |
LabAixBidouille/micropython | tests/pyb/can.py | 11aa6ba456287d6c80598a7ebbebd2887ce8f5a2 | from pyb import CAN
CAN.initfilterbanks(14)
can = CAN(1)
print(can)
can.init(CAN.LOOPBACK)
print(can)
print(can.any(0))
# Catch all filter
can.setfilter(0, CAN.MASK16, 0, (0, 0, 0, 0))
can.send('abcd', 123)
print(can.any(0))
print(can.recv(0))
can.send('abcd', -1)
print(can.recv(0))
can.send('abcd', 0x7FF + 1)
pr... | [((21, 44), 'pyb.CAN.initfilterbanks', 'CAN.initfilterbanks', (['(14)'], {}), '(14)\n', (40, 44), False, 'from pyb import CAN\n'), ((51, 57), 'pyb.CAN', 'CAN', (['(1)'], {}), '(1)\n', (54, 57), False, 'from pyb import CAN\n'), ((504, 539), 'pyb.CAN', 'CAN', (['(1)', 'CAN.LOOPBACK'], {'extframe': '(True)'}), '(1, CAN.LO... |
TahiG/pyquarkchain | quarkchain/cluster/tests/test_miner.py | 30da626ef6b50bd07b230aac05a3cef7fd7f23cf | import asyncio
import time
import unittest
from typing import Optional
from quarkchain.cluster.miner import DoubleSHA256, Miner, MiningWork, validate_seal
from quarkchain.config import ConsensusType
from quarkchain.core import RootBlock, RootBlockHeader
from quarkchain.p2p import ecies
from quarkchain.utils import sha... | [((2591, 2615), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (2613, 2615), False, 'import asyncio\n'), ((3436, 3491), 'quarkchain.cluster.miner.validate_seal', 'validate_seal', (['block.header', 'ConsensusType.POW_SHA3SHA3'], {}), '(block.header, ConsensusType.POW_SHA3SHA3)\n', (3449, 3491), Fa... |
nriesterer/iccm-neural-bound | analysis/networks/autoencoder/train_eval.py | e14b103ba2c81a197de5b0edf948c19d57f0d3ba | """ Evaluates the training performance of the autoencoder.
"""
import time
import pandas as pd
import numpy as np
import torch
import torch.optim as optim
import torch.nn as nn
import ccobra
import onehot
import autoencoder
# General settings
training_datafile = '../../data/Ragni-train.csv'
test_datafile = '../.... | [((380, 414), 'autoencoder.DenoisingAutoencoder', 'autoencoder.DenoisingAutoencoder', ([], {}), '()\n', (412, 414), False, 'import autoencoder\n'), ((427, 439), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (437, 439), True, 'import torch.nn as nn\n'), ((587, 608), 'pandas.read_csv', 'pd.read_csv', (['datafile'],... |
Aver58/ColaFrameWork | Tools/GAutomator/wpyscripts/uiautomator/uiautomator_manager.py | 04c6750305ad734b30eceb95b463695b8373845a | #-*- coding: UTF-8 -*-
"""
Tencent is pleased to support the open source community by making GAutomator available.
Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a... | [((885, 912), 'logging.getLogger', 'logging.getLogger', (['"""wetest"""'], {}), "('wetest')\n", (902, 912), False, 'import logging\n'), ((952, 995), 'os.environ.get', 'os.environ.get', (['"""UIAUTOMATOR_PORT"""', '"""19008"""'], {}), "('UIAUTOMATOR_PORT', '19008')\n", (966, 995), False, 'import os\n'), ((1278, 1287), '... |
timkrentz/SunTracker | IMU/VTK-6.2.0/Filters/Core/Testing/Python/TestSynchronizedTemplates3D.py | 9a189cc38f45e5fbc4e4c700d7295a871d022795 | #!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
class TestSynchronizedTemplates3D(Testing.vtkTest):
def testAll(self):
reader = vtk.vtkImageReader()
reader.SetDataByteOrderToLittleEndian()
reader.SetDataExte... | [((123, 139), 'vtk.util.misc.vtkGetDataRoot', 'vtkGetDataRoot', ([], {}), '()\n', (137, 139), False, 'from vtk.util.misc import vtkGetDataRoot\n'), ((2206, 2259), 'vtk.test.Testing.main', 'Testing.main', (["[(TestSynchronizedTemplates3D, 'test')]"], {}), "([(TestSynchronizedTemplates3D, 'test')])\n", (2218, 2259), Fals... |
iAndriy/deserialize | deserialize/__init__.py | 3552517873d68d3bb953b44dd9512f0e0d045191 | """A module for deserializing data to Python objects."""
# pylint: disable=unidiomatic-typecheck
# pylint: disable=protected-access
# pylint: disable=too-many-branches
# pylint: disable=wildcard-import
import enum
import functools
import typing
from typing import Any, Callable, Dict, List, Optional, Union
from deser... | [((10847, 10883), 'deserialize.decorators._get_downcast_field', '_get_downcast_field', (['class_reference'], {}), '(class_reference)\n', (10866, 10883), False, 'from deserialize.decorators import downcast_field, _get_downcast_field, downcast_identifier, _get_downcast_class, allow_downcast_fallback, _allows_downcast_fal... |
snoopyjc/ssf | tests/test_get_set.py | b995cae0e90d38e3758d4944fb144831f9bae0a5 | from ssf import SSF
ssf = SSF(errors='raise')
def test_get_set_days():
dn = ssf.get_day_names()
assert isinstance(dn, tuple)
assert dn == (('Mon', 'Monday'),
('Tue', 'Tuesday'),
('Wed', 'Wednesday'),
('Thu', 'Thursday'),
('Fri', 'Friday'),
('Sat',... | [((26, 45), 'ssf.SSF', 'SSF', ([], {'errors': '"""raise"""'}), "(errors='raise')\n", (29, 45), False, 'from ssf import SSF\n')] |
devppratik/Youtube-Downloader | script.py | ccdf31b83fbce2d05711c64dbad729c935c72b8a | import os
import pyfiglet
from pytube import YouTube, Playlist
file_size = 0
folder_name = ""
# Progress Bar
def print_progress_bar(iteration, total, prefix='', suffix='', decimals=1, length=100, fill='#', print_end="\r"):
percent = ("{0:." + str(decimals) + "f}").format(100 *
... | [((1161, 1219), 'pytube.YouTube', 'YouTube', (['video_url'], {'on_progress_callback': 'show_progress_bar'}), '(video_url, on_progress_callback=show_progress_bar)\n', (1168, 1219), False, 'from pytube import YouTube, Playlist\n'), ((2282, 2340), 'pytube.YouTube', 'YouTube', (['video_url'], {'on_progress_callback': 'show... |
alex952/cdr | test/python/test.py | e8dce20c2cc635e5ad8bf16a16ec4f7d9a86ac16 | #
# Copyright 2014-2018 Neueda Ltd.
#
from cdr import Cdr
import unittest
field1 = 1
field2 = 2
field3 = 55
class TestCdr(unittest.TestCase):
def get_a_cdr(self):
d = Cdr()
d.setInteger(field1, 123)
d.setString(field2, "Hello")
d.setString(field3, "World")
return d
... | [((1531, 1546), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1544, 1546), False, 'import unittest\n'), ((184, 189), 'cdr.Cdr', 'Cdr', ([], {}), '()\n', (187, 189), False, 'from cdr import Cdr\n'), ((762, 767), 'cdr.Cdr', 'Cdr', ([], {}), '()\n', (765, 767), False, 'from cdr import Cdr\n'), ((887, 892), 'cdr.Cdr... |
klahnakoski/auth0-api | vendor/mo_times/vendor/dateutil/tz.py | eda9c2554c641da76687f64445b8d35543d012d9 | """
Copyright (c) 2003-2007 Gustavo Niemeyer <gustavo@niemeyer.net>
This module offers extensions to the standard Python
datetime module.
"""
import datetime
import os
import struct
import sys
import time
from mo_future import PY3, string_types
__license__ = "Simplified BSD"
__all__ = ["tzutc", "tzoffset", "tzloca... | [((970, 991), 'datetime.timedelta', 'datetime.timedelta', (['(0)'], {}), '(0)\n', (988, 991), False, 'import datetime\n'), ((2400, 2442), 'datetime.timedelta', 'datetime.timedelta', ([], {'seconds': '(-time.timezone)'}), '(seconds=-time.timezone)\n', (2418, 2442), False, 'import datetime\n'), ((1007, 1044), 'datetime.d... |
suuperhu/Pyside2MVCFramework | example/first_example/window/inputWindow/view.py | c28bd0fbb6b53bb2cdad8d0723b4251fc93319d6 | # -*- coding: utf-8 -*-
"""
# @SoftwareIDE : PyCharm2020Pro
# @ProjectName : PySide2MVCFramework
# @FileName : view.py
# @Author : 胡守杰
# @Email : 2839414139@qq.com
# @ZhFileDescription :
# @EnFileDescription :
"""
import os
from pyside2mvcframework.core.v... | [((427, 494), 'os.path.join', 'os.path.join', (['BASE_PATH', '"""src\\\\window\\\\inputWindow\\\\inputWindow.ui"""'], {}), "(BASE_PATH, 'src\\\\window\\\\inputWindow\\\\inputWindow.ui')\n", (439, 494), False, 'import os\n'), ((662, 684), 'PySide2.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\... |
AlexMontgomerie/finn | src/finn/custom_op/fpgadataflow/streamingfifo.py | ec5f67b333ad4db4acf6191c3b5ab5e9067347aa | # Copyright (c) 2020, Xilinx
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the follow... | [((4864, 4888), 'os.makedirs', 'os.makedirs', (['verilog_dir'], {}), '(verilog_dir)\n', (4875, 4888), False, 'import os\n'), ((5036, 5074), 'os.path.join', 'os.path.join', (['memstream_dir', '"""Q_srl.v"""'], {}), "(memstream_dir, 'Q_srl.v')\n", (5048, 5074), False, 'import os\n'), ((5083, 5108), 'shutil.copy', 'copy',... |
chrissimpkins/android_fonts | android_fonts.py | f904147774836468a8c011b1596f85577220b140 | import ast
import emoji
import os
import pandas as pd
_SUPPORT_CACHE_CSV = emoji.datafile('emoji_support.csv')
_API_LEVELS = {
1: ("(no codename)", "1.0"),
2: ("(no codename)", "1.1"),
3: ("Cupcake", "1.5 "),
4: ("Donut", "1.6 "),
5: ("Eclair", "2.0"),
6: ("Eclair", "2.0.1"),
7: ("Eclair", "2.1 "),
8:... | [((76, 111), 'emoji.datafile', 'emoji.datafile', (['"""emoji_support.csv"""'], {}), "('emoji_support.csv')\n", (90, 111), False, 'import emoji\n'), ((1107, 1129), 'os.path.splitext', 'os.path.splitext', (['file'], {}), '(file)\n', (1123, 1129), False, 'import os\n'), ((1238, 1258), 'os.walk', 'os.walk', (['"""api_level... |
amikrop/django-paste | tests/test_list.py | 109f6e5a42bdc20f3cb671471b3ce5c9e329148b | import json
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from paste import constants
from tests.mixins import SnippetListTestCaseMixin
from tests.utils import constant, create_snippet, create_user
class SnippetListTestCase(SnippetListTestCaseMixin, ... | [((455, 478), 'django.urls.reverse', 'reverse', (['"""snippet-list"""'], {}), "('snippet-list')\n", (462, 478), False, 'from django.urls import reverse\n'), ((927, 948), 'tests.utils.create_snippet', 'create_snippet', (['"""foo"""'], {}), "('foo')\n", (941, 948), False, 'from tests.utils import constant, create_snippet... |
ganeshbhandarkar/Python-Projects | Algorithmic Toolbox/Greedy Algorithms/Maximum Advertisement Revenue/maximum_ad_revenue.py | a4df933122a6694d249c69d1e8e95b592cf036a0 | # python3
from itertools import permutations
def max_dot_product_naive(first_sequence, second_sequence):
assert len(first_sequence) == len(second_sequence)
assert len(first_sequence) <= 10 ** 3
assert all(0 <= f <= 10 ** 5 for f in first_sequence)
assert all(0 <= s <= 10 ** 5 for s in second_sequence... | [] |
SamIge7/Tutorials | HelloWorldPython/IfStatements.py | 7a3361768432a6493313d1f0ea1ccc8b2b916aa2 | hasGoodCredit = True
price = 1000000
deposit = 0
if hasGoodCredit:
deposit = price/10
else:
deposit = price/5
print(f"Deposit needed: £{deposit}") | [] |
vsundesha/documentation-hub-dependencies | main.py | 3cdb7c28ceefb7c4ece60fd5e9d3e89640bb0d01 | import config as props
import sys
import getopt
from GitHubDataFetcher import GitHubDataFetcher
from DependencyFile import DependencyFile
from ErrorFile import ErrorFile
# Github Token
TOKEN = props.token
OWNER = ""
REPOSITORY = ""
OUTPUTFILE = ""
def showHelp():
print('-r or --repo The name of t... | [((745, 811), 'getopt.getopt', 'getopt.getopt', (['argv', '"""hr:o:f:"""', "['repo=', 'owner=', 'outputfile=']"], {}), "(argv, 'hr:o:f:', ['repo=', 'owner=', 'outputfile='])\n", (758, 811), False, 'import getopt\n'), ((1330, 1373), 'GitHubDataFetcher.GitHubDataFetcher', 'GitHubDataFetcher', (['OWNER', 'REPOSITORY', 'TO... |
blabra/Real-ESRGAN | inference_realesrgan.py | bd5c69d2ef30f27cc2a510443451a2dc841aec28 | import argparse
import cv2
import glob
import os
from basicsr.archs.rrdbnet_arch import RRDBNet
import time
from realesrgan import RealESRGANer
from realesrgan.archs.srvgg_arch import SRVGGNetCompact
def main():
"""Inference demo for Real-ESRGAN.
"""
parser = argparse.ArgumentParser()
parser.add_argu... | [((275, 300), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (298, 300), False, 'import argparse\n'), ((3590, 3661), 'os.path.join', 'os.path.join', (['"""experiments/pretrained_models"""', "(args.model_name + '.pth')"], {}), "('experiments/pretrained_models', args.model_name + '.pth')\n", (360... |
eragasa/pypospack | examples/Fe__vasp/Fe_fcc_afm_D/Fe_fcc_afm_D_vac_A/clean_vasp.py | 21cdecaf3b05c87acc532d992be2c04d85bfbc22 | import os
filenames_delete = [
'CHG',
'CHGCAR',
'CONTCAR',
'DOSCAR',
'EIGENVAL',
'IBZKPT',
'job.err',
'job.out',
'OSZICAR',
'PCDAT',
'REPORT',
'vasp.log',
'vasprun.xml',
'WAVECAR',
'XDATCAR'
]
for filename in filenames_delete:
try:
... | [((322, 341), 'os.remove', 'os.remove', (['filename'], {}), '(filename)\n', (331, 341), False, 'import os\n')] |
ethyl2/code_challenges | binary_trees/largest_values_in_tree_rows.py | 3c9ccca1782f92728e60a515a7ca797f6d470e81 | '''
Sean Chen's solution.
See mine in largest_values_in_each_row.py
'''
from collection import deque
def largest_values_in_tree_rows(t):
rv = []
if t is None:
return rv
current_depth = 0
current_max = t.value
q = deque()
# add the root node to the queue at a depth of 0
q.append... | [((246, 253), 'collection.deque', 'deque', ([], {}), '()\n', (251, 253), False, 'from collection import deque\n')] |
RamsteinWR/PneumoniaRSNA1 | src/infer/_ExtractSimpleDeformTTA.py | 08bdba51292307a78ef711c6be4a63faea240ddf | import json
import os
import re
import numpy as np
import pandas as pd
from src.infer.ExtractDeformableTTA import MAPPINGS_PATH, test_image_set, METADATA_PATH, RCNN0_DETS_DIR
WDIR = os.path.dirname(os.path.abspath(__file__))
def get_results(det_folder, test_set, suffix):
filepath = os.path.join(det_folder, tes... | [((2320, 2346), 'pandas.read_csv', 'pd.read_csv', (['METADATA_PATH'], {}), '(METADATA_PATH)\n', (2331, 2346), True, 'import pandas as pd\n'), ((201, 226), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (216, 226), False, 'import os\n'), ((2173, 2185), 'json.load', 'json.load', (['f'], {}), '(... |
yfii/yfiiapi | pool4.py | 2c0341b66108f99005dc5a40e3d1d30267f50bb5 | from web3 import Web3, HTTPProvider
import json
w3url = "https://mainnet.infura.io/v3/998f64f3627548bbaf2630599c1eefca"
w3 = Web3(HTTPProvider(w3url))
WETH = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
YFII = "0xa1d0E215a23d7030842FC67cE582a6aFa3CCaB83"
DAI = "0x6B175474E89094C44Da98b954EedeAC495271d0F"
iUSDT = "0x... | [((132, 151), 'web3.HTTPProvider', 'HTTPProvider', (['w3url'], {}), '(w3url)\n', (144, 151), False, 'from web3 import Web3, HTTPProvider\n')] |
PanBartosz/obs-websocket-py | obswebsocket/requests.py | e92960a475d3f1096a4ea41763cbc776b23f0a37 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# THIS FILE WAS GENERATED BY generate_classes.py - DO NOT EDIT #
# (Generated on 2020-12-20 18:26:33.661372) #
from .base_classes import Baserequests
class GetVersion(Baserequests):
"""Returns the latest version of the plugin and the API.
:Returns:
*vers... | [] |
rdurica/django-simple-history | simple_history/tests/custom_user/admin.py | 84d17f40be68e9ac7744b773451be83720c4c13a | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from .models import CustomUser
admin.site.register(CustomUser, UserAdmin)
| [((114, 156), 'django.contrib.admin.site.register', 'admin.site.register', (['CustomUser', 'UserAdmin'], {}), '(CustomUser, UserAdmin)\n', (133, 156), False, 'from django.contrib import admin\n')] |
Pandinosaurus/open_model_zoo | tools/accuracy_checker/openvino/tools/accuracy_checker/evaluators/custom_evaluators/mtcnn_evaluator_utils.py | 2543996541346418919c5cddfb71e33e2cdef080 | """
Copyright (c) 2018-2022 Intel Corporation
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 wri... | [((4091, 4106), 'numpy.ones', 'np.ones', (['numbox'], {}), '(numbox)\n', (4098, 4106), True, 'import numpy as np\n'), ((4116, 4131), 'numpy.ones', 'np.ones', (['numbox'], {}), '(numbox)\n', (4123, 4131), True, 'import numpy as np\n'), ((4893, 4913), 'numpy.maximum', 'np.maximum', (['(0)', '(y - 1)'], {}), '(0, y - 1)\n... |
ashwin2002/TAF | pytests/Atomicity/basic_ops.py | 4223787a1f4c0fe9fa841543020b48ada9ade9e3 | from Cb_constants import DocLoading
from basetestcase import ClusterSetup
from couchbase_helper.documentgenerator import DocumentGenerator, doc_generator
from couchbase_helper.tuq_generators import JsonGenerator
from remote.remote_util import RemoteMachineShellConnection
from sdk_client3 import SDKClient
from com.couc... | [((1459, 1478), 'com.couchbase.client.java.json.JsonObject.create', 'JsonObject.create', ([], {}), '()\n', (1476, 1478), False, 'from com.couchbase.client.java.json import JsonObject\n'), ((1609, 1803), 'couchbase_helper.documentgenerator.DocumentGenerator', 'DocumentGenerator', (['self.key', 'template'], {'randomize':... |
lovefov/Python | reverseWord.py | ba8fc49e6e503927dc1f827f37b77f3e43b5d0c8 | #!/usr/bin/env python3
#-*- coding:utf-8 -*-
#Author:贾江超
def spin_words(sentence):
list1=sentence.split()
l=len(list1)
for i in range(l):
relen = len(sentence.split()[i:][0])
if relen > 5:
list1[i]=list1[i][::-1]
return ' '.join(list1)
'''
注意 在2.x版本可以用len()得到list的长度 3.x版本就不行... | [] |
south-coast-science/scs_host_cpc | src/scs_host/comms/network_socket.py | 08b4a28c022936462b60823cca136ba6746eac57 | """
Created on 30 May 2017
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
A network socket abstraction, implementing ProcessComms
"""
import socket
import time
from scs_core.sys.process_comms import ProcessComms
# ----------------------------------------------------------------------------------------... | [((881, 942), 'socket.socket', 'socket.socket', ([], {'family': 'socket.AF_INET', 'type': 'socket.SOCK_STREAM'}), '(family=socket.AF_INET, type=socket.SOCK_STREAM)\n', (894, 942), False, 'import socket\n'), ((1422, 1437), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (1432, 1437), False, 'import time\n'), ((2... |
JKhakpour/dateparser | dateparser/date.py | 7f324cfd3de04e91752979cf65ae0dedc622375f | # -*- coding: utf-8 -*-
import calendar
import collections
from datetime import datetime, timedelta
from warnings import warn
import six
import regex as re
from dateutil.relativedelta import relativedelta
from dateparser.date_parser import date_parser
from dateparser.freshness_date_parser import freshness_date_parser... | [((1129, 1166), 'regex.compile', 're.compile', (['u"""\xa0"""'], {'flags': 're.UNICODE'}), "(u'\\xa0', flags=re.UNICODE)\n", (1139, 1166), True, 'import regex as re\n'), ((1179, 1197), 'regex.compile', 're.compile', (['"""\\\\s+"""'], {}), "('\\\\s+')\n", (1189, 1197), True, 'import regex as re\n'), ((1215, 1247), 'reg... |
kristofbc/handwriting-synthesis | src/models/functions/connection/mixture_density_network.py | 16505e89fd7275d4cd3ed9c4388c9f3c153a0397 | import chainer
import chainer.functions
from chainer.utils import type_check
from chainer import cuda
from chainer import function
import numpy as np
#from chainer import function_node
from utils import clip_grad
#class MixtureDensityNetworkFunction(function_node.FunctionNode):
class MixtureDensityNetworkFunction(fu... | [((583, 1553), 'chainer.utils.type_check.expect', 'type_check.expect', (["(x_type.dtype.kind == 'f')", "(eos_input_type.dtype.kind == 'f')", "(pi_input_type.dtype.kind == 'f')", "(mu_x1_input_type.dtype.kind == 'f')", "(mu_x2_input_type.dtype.kind == 'f')", "(s_x1_input_type.dtype.kind == 'f')", "(s_x2_input_type.dtype... |
DazEB2/SimplePyScripts | flask__webservers/bootstrap_4__toggle_switch__examples/main.py | 1dde0a42ba93fe89609855d6db8af1c63b1ab7cc | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# SOURCE: https://github.com/twbs/bootstrap
# SOURCE: https://github.com/gitbrent/bootstrap4-toggle
# SOURCE: https://gitbrent.github.io/bootstrap4-toggle/
from flask import Flask, render_template
app = Flask(__name__)
import logging
logging.b... | [((279, 294), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (284, 294), False, 'from flask import Flask, render_template\n'), ((311, 351), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (330, 351), False, 'import logging\n'), ((394, 423), 'flask.... |
eragasa/pypospack | dev/phonts/visualization/phonts.py | 21cdecaf3b05c87acc532d992be2c04d85bfbc22 | import pypospack.io.phonts as phonts
# <---- additional classes and functions in which to add top
# <---- pypospack.io.phonts
if __name__ == "__main__":
| [] |
sugatoray/omegaconf | omegaconf/_utils.py | edf9e86493a14b0e909e956d9bae59b9861ef9c5 | import copy
import os
import re
import string
import sys
import warnings
from contextlib import contextmanager
from enum import Enum
from textwrap import dedent
from typing import (
Any,
Dict,
Iterator,
List,
Optional,
Tuple,
Type,
Union,
get_type_hints,
)
import yaml
from .errors ... | [((1166, 1192), 're.compile', 're.compile', (['"""(\\\\.)*[^.[]*"""'], {}), "('(\\\\.)*[^.[]*')\n", (1176, 1192), False, 'import re\n'), ((1448, 1485), 're.compile', 're.compile', (['"""\\\\.([^.[]*)|\\\\[(.*?)\\\\]"""'], {}), "('\\\\.([^.[]*)|\\\\[(.*?)\\\\]')\n", (1458, 1485), False, 'import re\n'), ((4491, 4517), 'i... |
loostrum/darc | darc/amber_clustering.py | 977f43652ff4fc873340d09ac0fddeb81b889541 | #!/usr/bin/env python3
#
# AMBER Clustering
import os
from time import sleep
import yaml
import ast
import threading
import multiprocessing as mp
import numpy as np
from astropy.time import Time, TimeDelta
import astropy.units as u
from astropy.coordinates import SkyCoord
from darc import DARCBase, VOEventQueueServe... | [((1344, 1354), 'multiprocessing.Queue', 'mp.Queue', ([], {}), '()\n', (1352, 1354), True, 'import multiprocessing as mp\n'), ((1569, 1578), 'multiprocessing.Lock', 'mp.Lock', ([], {}), '()\n', (1576, 1578), True, 'import multiprocessing as mp\n'), ((1671, 1681), 'astropy.time.Time.now', 'Time.now', ([], {}), '()\n', (... |
glenn2763/skyportal | tools/load_demo_data.py | 79dc11bfe08076d9c1f920bad85681ab001e22c8 | import datetime
import os
import subprocess
import base64
from pathlib import Path
import shutil
import pandas as pd
import signal
import requests
from baselayer.app.env import load_env
from baselayer.app.model_util import status, create_tables, drop_tables
from social_tornado.models import TornadoStorage
from skyport... | [((613, 623), 'baselayer.app.env.load_env', 'load_env', ([], {}), '()\n', (621, 623), False, 'from baselayer.app.env import load_env\n'), ((687, 750), 'baselayer.app.model_util.status', 'status', (['f"""Connecting to database {cfg[\'database\'][\'database\']}"""'], {}), '(f"Connecting to database {cfg[\'database\'][\'d... |
UncleWillis/BugBox | framework/Exploits/CUTEFLOW_0024.py | 25682f25fc3222db383649a4924bcd65f2ddcb34 |
# Copyright 2013 University of Maryland. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE.TXT file.
import sys
import os
import time
from selenium.common.exceptions import NoAlertPresentException
import framework
class Exploit (framework.Exploit... | [((825, 866), 'framework.Exploit.__init__', 'framework.Exploit.__init__', (['self', 'visible'], {}), '(self, visible)\n', (851, 866), False, 'import framework\n'), ((1428, 1442), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (1438, 1442), False, 'import time\n')] |
HosseyNJF/Telethon | telethon/tl/custom/button.py | 0b0a1dc6a1a3f2fc8593526549889fba2884e8b8 | from .. import types
from ... import utils
class Button:
"""
.. note::
This class is used to **define** reply markups, e.g. when
sending a message or replying to events. When you access
`Message.buttons <telethon.tl.custom.message.Message.buttons>`
they are actually `MessageBu... | [] |
addUsername/javaBoring | src/main/resources/pys/join.py | d576adbd21447085f56719e8cc871faf94d8a369 | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 7 20:14:22 2020
Simple script to join json files
@author: SERGI
"""
import json
import sys
import os
def readJson(path):
with open(path, "r") as file:
return json.load(file)
def writeJson(path, dicc):
with open(path, "w") as file... | [((743, 767), 'os.listdir', 'os.listdir', (['jsonPathTemp'], {}), '(jsonPathTemp)\n', (753, 767), False, 'import os\n'), ((237, 252), 'json.load', 'json.load', (['file'], {}), '(file)\n', (246, 252), False, 'import json\n'), ((331, 352), 'json.dump', 'json.dump', (['dicc', 'file'], {}), '(dicc, file)\n', (340, 352), Fa... |
njmhendrix/grand-challenge.org | app/grandchallenge/challenges/migrations/0023_auto_20200123_1102.py | 9bc36f5e26561a78bd405e8ea5e4c0f86c95f011 | # Generated by Django 3.0.2 on 2020-01-23 11:02
import re
import django.contrib.postgres.fields.citext
import django.core.validators
from django.db import migrations
import grandchallenge.challenges.models
class Migration(migrations.Migration):
dependencies = [
("challenges", "0022_auto_20200121_1639"... | [((861, 893), 're.compile', 're.compile', (['"""^[-a-zA-Z0-9_]+\\\\Z"""'], {}), "('^[-a-zA-Z0-9_]+\\\\Z')\n", (871, 893), False, 'import re\n'), ((1696, 1728), 're.compile', 're.compile', (['"""^[-a-zA-Z0-9_]+\\\\Z"""'], {}), "('^[-a-zA-Z0-9_]+\\\\Z')\n", (1706, 1728), False, 'import re\n')] |
hmendozap/master-arbeit-files | autosk_dev_test/component/LinReg.py | 5c1b90bc4a424313234b84bad405799de6f8d2ed | import numpy as np
import scipy.sparse as sp
from HPOlibConfigSpace.configuration_space import ConfigurationSpace
from HPOlibConfigSpace.conditions import EqualsCondition, InCondition
from HPOlibConfigSpace.hyperparameters import UniformFloatHyperparameter, \
UniformIntegerHyperparameter, CategoricalHyperparameter... | [((1870, 1880), 'numpy.mean', 'np.mean', (['y'], {}), '(y)\n', (1877, 1880), True, 'import numpy as np\n'), ((1902, 1911), 'numpy.std', 'np.std', (['y'], {}), '(y)\n', (1908, 1911), True, 'import numpy as np\n'), ((2045, 2059), 'scipy.sparse.issparse', 'sp.issparse', (['X'], {}), '(X)\n', (2056, 2059), True, 'import sc... |
Elektra-2/python_crash_course_2nd | python_work/Chapter5/exe3_alien_color.py | 1c8beaddfe037faa3a36e7c384a6ea2f9d560060 | # Creating a elif chain
alien_color = 'red'
if alien_color == 'green':
print('Congratulations! You won 5 points!')
elif alien_color == 'yellow':
print('Congratulations! You won 10 points!')
elif alien_color == 'red':
print('Congratulations! You won 15 points!')
| [] |
larryzhang95/Voice-Analysis-Pipeline | DigiPsych_API/Data_Science_API/evaluate_model.py | 264ac5c70d0baab47b81718ea5b895be30a683e9 | import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.model_selection import learning_curve
# Plot learning curve
def plot_learning_curve(estimator, title, X, y, ylim=None, cv=None,
n_jobs=1, train_sizes=np.linspace(.1, 1.0, 5)):
plt.figu... | [((282, 306), 'numpy.linspace', 'np.linspace', (['(0.1)', '(1.0)', '(5)'], {}), '(0.1, 1.0, 5)\n', (293, 306), True, 'import numpy as np\n'), ((312, 324), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (322, 324), True, 'import matplotlib.pyplot as plt\n'), ((329, 345), 'matplotlib.pyplot.title', 'plt.titl... |
sremes/oomi | oomi/__init__.py | 312317aa2ef68f1481b2447652a7d47c5f2e3f56 | """Utilities for downloading comsumption data from Oomi."""
from oomi.oomi_downloader import OomiDownloader, OomiConfig
| [] |
KaoTuz/edk2-stable202108 | BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py | 49d9306e7bf64b2f07d8473be1f2faea49d0a012 | ## @file
# This file is used to define class objects of INF file miscellaneous.
# Include BootMode/HOB/Event and others. It will consumed by InfParser.
#
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
'''
InfMisc
'''
import Logger.Log as Logge... | [((3454, 3593), 'Logger.Log.Error', 'Logger.Error', (['"""InfParser"""', 'ErrorCode'], {'Message': 'Message', 'File': 'LineInfo[0]', 'Line': 'LineInfo[1]', 'ExtraData': 'LineInfo[2]', 'RaiseError': 'RaiseError'}), "('InfParser', ErrorCode, Message=Message, File=LineInfo[0],\n Line=LineInfo[1], ExtraData=LineInfo[2],... |
allenalvin333/Codechef_Competitions | 21-08/Starters8/1.py | 44c3626de33cd9e17d1acfc74abe0aab809efbad | # https://www.codechef.com/START8C/problems/PENALTY
for T in range(int(input())):
n=list(map(int,input().split()))
a=b=0
for i in range(len(n)):
if(n[i]==1):
if(i%2==0): a+=1
else: b+=1
if(a>b): print(1)
elif(b>a): print(2)
else: print(0) | [] |
jhong93/vpd | util/eval.py | 1ed3e8631c46e078ecb9a7756dba1f1c14aead5b | import matplotlib.pyplot as plt
from sklearn.metrics import ConfusionMatrixDisplay, confusion_matrix
def save_confusion_matrix(truth, pred, out_file, norm=None):
label_names = list(set(truth) | set(pred))
label_names.sort()
truth_compact = [label_names.index(x) for x in truth]
pred_compact = [label_na... | [((527, 555), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 20)'}), '(figsize=(20, 20))\n', (537, 555), True, 'import matplotlib.pyplot as plt\n'), ((597, 668), 'sklearn.metrics.ConfusionMatrixDisplay', 'ConfusionMatrixDisplay', ([], {'confusion_matrix': 'cm', 'display_labels': 'label_names'}), '(con... |
sillyemperor/langstudy | python/py3study/pytorch-lab/demo-cifar.py | 937a11d97984e10e4ead54f3b7b7d6a1f2ef24a1 | import torch
import torchvision
import torchvision.transforms as transforms
import os.path
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
transform = transforms.Compose(
[transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])
root = os.path.join(BASE_DIR, '../data/')
trainset ... | [((322, 413), 'torchvision.datasets.CIFAR10', 'torchvision.datasets.CIFAR10', ([], {'root': 'root', 'train': '(True)', 'download': '(True)', 'transform': 'transform'}), '(root=root, train=True, download=True,\n transform=transform)\n', (350, 413), False, 'import torchvision\n'), ((464, 530), 'torch.utils.data.DataLo... |
B612-Asteroid-Institute/astroquery | astroquery/neodys/tests/test_neodys_remote.py | 4bc8002639e80f7356306f4e000334da5e086091 |
from ... import neodys
def test_neodys_query():
test_object = "2018VP1"
res_kep_0 = neodys.core.NEODyS.query_object(
test_object, orbital_element_type="ke", epoch_near_present=0)
res_kep_1 = neodys.core.NEODyS.query_object(
test_object, orbital_element_type="ke", epoch_near_present=1)
... | [] |
kkrampa/commcare-hq | corehq/apps/accounting/migrations/0026_auto_20180508_1956.py | d64d7cad98b240325ad669ccc7effb07721b4d44 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-05-08 19:56
from __future__ import unicode_literals
from __future__ import absolute_import
from django.db import migrations
def noop(*args, **kwargs):
pass
def _convert_emailed_to_array_field(apps, schema_editor):
BillingRecord = apps.get_model... | [((949, 1021), 'django.db.migrations.RunPython', 'migrations.RunPython', (['_convert_emailed_to_array_field'], {'reverse_code': 'noop'}), '(_convert_emailed_to_array_field, reverse_code=noop)\n', (969, 1021), False, 'from django.db import migrations\n')] |
SouBanerjee/tensor2tensor | tensor2tensor/rl/evaluator.py | 8b88b13dd65bf52b3c27663a128adb7b0a5773fb | # coding=utf-8
# Copyright 2018 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | [((3123, 3255), 'tensorflow.contrib.training.HParams', 'tf.contrib.training.HParams', ([], {'num_rollouts': '(1)', 'planning_horizon': '(2)', 'rollout_agent_type': '"""random"""', 'batch_size': '(1)', 'env_type': '"""simulated"""'}), "(num_rollouts=1, planning_horizon=2,\n rollout_agent_type='random', batch_size=1, ... |
AndreiHustiuc/IT_Factory_Course | src/part_2_automation/test_test1.py | c6f3e4a9282a1c19c0f52c79f0c81f026814a02a | # Generated by Selenium IDE
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWa... | [((522, 540), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {}), '()\n', (538, 540), False, 'from selenium import webdriver\n')] |
njmhendrix/grand-challenge.org | app/grandchallenge/components/admin.py | 9bc36f5e26561a78bd405e8ea5e4c0f86c95f011 | from django.contrib import admin
from grandchallenge.components.models import (
ComponentInterface,
ComponentInterfaceValue,
)
class ComponentInterfaceAdmin(admin.ModelAdmin):
list_display = (
"pk",
"title",
"slug",
"kind",
"default_value",
"relative_path",... | [((592, 656), 'django.contrib.admin.site.register', 'admin.site.register', (['ComponentInterface', 'ComponentInterfaceAdmin'], {}), '(ComponentInterface, ComponentInterfaceAdmin)\n', (611, 656), False, 'from django.contrib import admin\n'), ((657, 731), 'django.contrib.admin.site.register', 'admin.site.register', (['Co... |
paragguruji/publishtimer | publishtimer/__init__.py | b0b68d6c4d450a2cc22d29725e43c2a1261f0f74 | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 28 15:28:24 2016
@author: Parag Guruji, paragguruji@gmail.com
"""
from .helpers import setup_env
done = setup_env() | [] |
jjlawren/netdisco | netdisco/discoverables/nanoleaf_aurora.py | ffc3cd092bff359b1c1fc1ed51940624b3c8076b | """Discover Nanoleaf Aurora devices."""
from . import MDNSDiscoverable
class Discoverable(MDNSDiscoverable):
"""Add support for discovering Nanoleaf Aurora devices."""
def __init__(self, nd):
super(Discoverable, self).__init__(nd, '_nanoleafapi._tcp.local.')
| [] |
DavidSabbagh/meeg_power_regression | debug/compute_score_common_ts_RETREAT.py | d9cd5e30028ffc24f08a52966c7641f611e92ee6 | import os.path as op
import numpy as np
import pandas as pd
from sklearn.pipeline import make_pipeline
from sklearn.linear_model import RidgeCV
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import KFold, cross_val_score
import mne
from pyriemann.tangentspace import TangentSpace
import ... | [((414, 469), 'sklearn.model_selection.KFold', 'KFold', ([], {'n_splits': 'n_jobs', 'shuffle': '(True)', 'random_state': 'seed'}), '(n_splits=n_jobs, shuffle=True, random_state=seed)\n', (419, 469), False, 'from sklearn.model_selection import KFold, cross_val_score\n'), ((1494, 1548), 'os.path.join', 'op.join', (['cfg.... |
mengalong/bter | bter/publish.py | 7fa56f9c83429bc564e6d123498b14aae5c390b1 | # Copyright 2017~ mengalong <alongmeng@gmail.com>
#
# 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 ... | [((701, 729), 'daiquiri.getLogger', 'daiquiri.getLogger', (['__name__'], {}), '(__name__)\n', (719, 729), False, 'import daiquiri\n'), ((869, 891), 'six.moves.urllib.parse.urlparse', 'urlparse.urlparse', (['url'], {}), '(url)\n', (886, 891), True, 'from six.moves.urllib import parse as urlparse\n'), ((1000, 1109), 'ste... |
y19818/web3.py | web3/_utils/module_testing/math_contract.py | 32a85a287ab63220d1e0c06d77be74de595ff02f |
MATH_BYTECODE = (
"606060405261022e806100126000396000f360606040523615610074576000357c01000000000000"
"000000000000000000000000000000000000000000009004806316216f391461007657806361bc22"
"1a146100995780637cf5dab0146100bc578063a5f3c23b146100e8578063d09de08a1461011d5780"
"63dcf537b11461014057610074565b... | [] |
nuby/open_dnsdb | dnsdb/config.py | 7fec703d8458083f0e6826393656055556e9f0b2 | # -*- coding: utf-8 -*-
import os
import sys
from datetime import timedelta
from oslo.config import cfg
CONF = cfg.CONF
CONF.register_opts([
cfg.StrOpt('log-dir'),
cfg.StrOpt('log-file'),
cfg.StrOpt('debug'),
cfg.StrOpt('verbose'),
], 'log')
CONF.register_opts([
cfg.StrOpt('connection'),
cf... | [((149, 170), 'oslo.config.cfg.StrOpt', 'cfg.StrOpt', (['"""log-dir"""'], {}), "('log-dir')\n", (159, 170), False, 'from oslo.config import cfg\n'), ((176, 198), 'oslo.config.cfg.StrOpt', 'cfg.StrOpt', (['"""log-file"""'], {}), "('log-file')\n", (186, 198), False, 'from oslo.config import cfg\n'), ((204, 223), 'oslo.co... |
cloudy/osr-rover-code | rover/rover.py | 07d370ae1cde75eaf2d279fcc7f220c95cf6d736 | from __future__ import print_function
import time
from rover import Robot
from connections import Connections
class Rover(Robot, Connections):
def __init__( self,
config,
bt_flag = 0,
xbox_flag = 0,
unix_flag = 0
):
self.bt_flag = bt_flag
self.xbox_flag = xbox_flag
self.unix_flag =... | [] |
scanner/django-aswiki | aswiki/parser.py | 318908eeccc8da324846ac5ffc4d4a206f560521 | #
# File: $Id: parser.py 1865 2008-10-28 00:47:27Z scanner $
#
"""
This is where the logic and definition of our wiki markup parser lives.
We use the Python Creoleparser (which requires Genshi)
We make a custom dialect so that the parser can know the URL base for
all of the topics (pages) in the wiki and some additio... | [((7504, 7544), 'aswiki.models.Topic.objects.css_class_name', 'Topic.objects.css_class_name', (['topic_name'], {}), '(topic_name)\n', (7532, 7544), False, 'from aswiki.models import Topic\n'), ((8157, 8213), 'genshi.builder.tag.a', 'builder.tag.a', (['arg_string'], {'href': "('mailto:%s' % arg_string)"}), "(arg_string,... |
anobi/django-oauth-api | oauth_api/validators.py | 95bf9b500dab326553a5a8a17d5c6da1a34f6ac4 | import base64
import binascii
from datetime import timedelta
from django.contrib.auth import authenticate
from django.utils import timezone
from oauthlib.oauth2 import RequestValidator
from oauth_api.models import get_application_model, AccessToken, AuthorizationCode, RefreshToken, AbstractApplication
from oauth_api... | [((1087, 1110), 'oauth_api.models.get_application_model', 'get_application_model', ([], {}), '()\n', (1108, 1110), False, 'from oauth_api.models import get_application_model, AccessToken, AuthorizationCode, RefreshToken, AbstractApplication\n'), ((5749, 5809), 'oauth_api.models.AuthorizationCode.objects.get', 'Authoriz... |
padmacho/pythontutorial | objects/fun_return.py | 80c58d2d6efc0c3598f92b627338c6cd9fda1759 | def modify(y):
return y # returns same reference. No new object is created
x = [1, 2, 3]
y = modify(x)
print("x == y", x == y)
print("x == y", x is y) | [] |
hberndl70/mooc-generator | edx_gen/_write_comps.py | 58ff77ece12b456887ec24db79d8baa87ecd5621 | import sys, os
import tarfile
import shutil
from edx_gen import _edx_consts
from edx_gen import _read_metadata
from edx_gen import _write_structure
from edx_gen import _write_comps
from edx_gen import _write_comp_html
from edx_gen import _write_comp_checkboxes
from edx_gen import _write_comp_video
from edx_gen i... | [((903, 935), 'edx_gen._markdown.convertMd', '_markdown.convertMd', (['md_filepath'], {}), '(md_filepath)\n', (922, 935), False, 'from edx_gen import _markdown\n'), ((3218, 3330), 'edx_gen._read_metadata.getMetaSettings', '_read_metadata.getMetaSettings', (['md_filepath', 'meta_tag', '_edx_consts.COMP_HTML_REQ', '_edx_... |
ByeonghoonJeon/Student-Grading | grading_program.py | eee55638aee4390d7758c1204b85cce7279ccdf7 | # 1. Create students score dictionary.
students_score = {}
# 2. Input student's name and check if input is correct. (Alphabet, period, and blank only.)
# 2.1 Creat a function that evaluate the validity of name.
def check_name(name):
# 2.1.1 Remove period and blank and check it if the name is comprised with on... | [] |
by46/recipe | test/test_utils.py | 203abd2141a536b66b4e57d073169a49395be1f0 | import unittest
from recipe import utils
class UtilTestCase(unittest.TestCase):
def test_valid_project_slug(self):
project_slug = "Recipe0123456789_mock"
self.assertTrue(utils.valid_project_slug(project_slug))
project_slug = 'Recipe00000000000000000000000000000000000000000000'
... | [((201, 239), 'recipe.utils.valid_project_slug', 'utils.valid_project_slug', (['project_slug'], {}), '(project_slug)\n', (225, 239), False, 'from recipe import utils\n'), ((345, 383), 'recipe.utils.valid_project_slug', 'utils.valid_project_slug', (['project_slug'], {}), '(project_slug)\n', (369, 383), False, 'from reci... |
wangxihao/rgbd-kinect-pose | extern/smplx_kinect/smplx_kinect/common/avakhitov_utils.py | 03180723c99759ba2500bcd42b5fe7a1d26eb507 | import numpy as np
import cv2
import os.path as osp
import json
from human_body_prior.tools.model_loader import load_vposer
import torch
vposer_ckpt = '/Vol1/dbstore/datasets/a.vakhitov/projects/pykinect_fresh/smplify-x/smplify-x-data/vposer_v1_0/'
def load_avakhitov_fits_vposer(vposer, part_path, dev_lbl):
po... | [((451, 484), 'numpy.load', 'np.load', (["(part_path + '/betas.npy')"], {}), "(part_path + '/betas.npy')\n", (458, 484), True, 'import numpy as np\n'), ((499, 534), 'numpy.load', 'np.load', (["(part_path + '/fid_lst.npy')"], {}), "(part_path + '/fid_lst.npy')\n", (506, 534), True, 'import numpy as np\n'), ((5335, 5384)... |
axelbarjon/mongodb-kubernetes-operator | scripts/dev/dockerutil.py | 13eb844c55774ce8a6de51edde1a66b4371f3ef6 | import docker
from dockerfile_generator import render
import os
import json
from tqdm import tqdm
from typing import Union, Any, Optional
def build_image(repo_url: str, tag: str, path: str) -> None:
"""
build_image builds the image with the given tag
"""
client = docker.from_env()
print(f"Buildin... | [((283, 300), 'docker.from_env', 'docker.from_env', ([], {}), '()\n', (298, 300), False, 'import docker\n'), ((565, 582), 'docker.from_env', 'docker.from_env', ([], {}), '()\n', (580, 582), False, 'import docker\n'), ((1315, 1332), 'docker.from_env', 'docker.from_env', ([], {}), '()\n', (1330, 1332), False, 'import doc... |
elowy01/igsr_analysis | scripts/VCF/UTILS/select_variants.py | ffea4885227c2299f886a4f41e70b6e1f6bb43da | from VcfFilter import VcfFilter
import argparse
import os
#get command line arguments
parser = argparse.ArgumentParser(description='Script to select a certain variant type from a VCF file')
#parameters
parser.add_argument('--bcftools_folder', type=str, required=True, help='Folder containing the Bcftools binary' )
p... | [((98, 197), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Script to select a certain variant type from a VCF file"""'}), "(description=\n 'Script to select a certain variant type from a VCF file')\n", (121, 197), False, 'import argparse\n'), ((779, 845), 'VcfFilter.VcfFilter', 'VcfF... |
martinphellwig/brython_wf | site/tests/unittests/test/test_base64.py | e169afc1e048cba0c12118b4cd6f109df6fe67c9 | import unittest
from test import support
import base64
import binascii
import os
import sys
import subprocess
class LegacyBase64TestCase(unittest.TestCase):
def test_encodebytes(self):
eq = self.assertEqual
eq(base64.encodebytes(b"www.python.org"), b"d3d3LnB5dGhvbi5vcmc=\n")
eq(base64.enc... | [((14605, 14635), 'test.support.run_unittest', 'support.run_unittest', (['__name__'], {}), '(__name__)\n', (14625, 14635), False, 'from test import support\n'), ((1913, 2017), 'io.BytesIO', 'BytesIO', (["b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#0^&*();:<>,. []{}'"], {}), "(\n b'abcdefghijkl... |
ChameleonCloud/portal | appliance_catalog/migrations/0015_appliance_icon_py3.py | 92a06fb926dc36e997b94fb8dcd22b7e0d24d3ee | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-02-25 20:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
"""Updates ImageField syntax for later version.
"""
dependencies = [
('appliance_catalog', '0014_auto_... | [((483, 550), 'django.db.models.ImageField', 'models.ImageField', ([], {'blank': '(True)', 'upload_to': '"""appliance_catalog/icons/"""'}), "(blank=True, upload_to='appliance_catalog/icons/')\n", (500, 550), False, 'from django.db import migrations, models\n')] |
ChristopherKchilton/twitoff-ChristopherKchilton | twitoff/twitter.py | fbac9899feff256ededab009b28e2f6ebd67f476 | """Retrieve and request tweets from the DS API"""
import requests
import spacy
from .models import DB, Tweet, User
nlp = spacy.load("my_model")
def vectorize_tweet(tweet_text):
return nlp(tweet_text).vector
# Add and updates tweets
def add_or_update_user(username):
"""Adds and updates the user with twiter ... | [((123, 145), 'spacy.load', 'spacy.load', (['"""my_model"""'], {}), "('my_model')\n", (133, 145), False, 'import spacy\n'), ((410, 486), 'requests.get', 'requests.get', (['f"""https://lambda-ds-twit-assist.herokuapp.com/user/{username}"""'], {}), "(f'https://lambda-ds-twit-assist.herokuapp.com/user/{username}')\n", (42... |
p88h/aoc2017 | day22.py | a929a8c0894559b0d7dd3d0b58c076295087f4c8 | import io
grid = {}
y = 0
x = 0
for l in io.open("day22.in").read().splitlines():
for x in range(len(l)):
grid[(y,x)] = l[x]
y += 1
y = y // 2
x = x // 2
dx = 0
dy = -1
r = 0
for iter in range(10000000):
if (y,x) not in grid or grid[(y,x)] == '.':
(dy, dx) = (-dx, dy)
grid[(y,x)] = ... | [((42, 61), 'io.open', 'io.open', (['"""day22.in"""'], {}), "('day22.in')\n", (49, 61), False, 'import io\n')] |
TheGoldfish01/pydpf-core | ansys/dpf/core/errors.py | 75ca8a180454f94cedafbc68c1d6f20dcfc4c795 | from grpc._channel import _InactiveRpcError, _MultiThreadedRendezvous
from functools import wraps
_COMPLEX_PLOTTING_ERROR_MSG = """
Complex fields cannot be plotted. Use operators to get the amplitude
or the result at a defined sweeping phase before plotting.
"""
_FIELD_CONTAINER_PLOTTING_MSG = """"
This fields_conta... | [((2939, 2950), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (2944, 2950), False, 'from functools import wraps\n')] |
yu961549745/pynote | ls10.py | 5976aeeca6368c0956baddf6a9ccb93ae8e0612a | '''
IO
'''
| [] |
askender/deep_disfluency | deep_disfluency/feature_extraction/wer_calculation_from_final_asr_results.py | bea8403ed954df8eadd3e2b9d98bb7c2b416a665 | from mumodo.mumodoIO import open_intervalframe_from_textgrid
import numpy
from deep_disfluency.utils.accuracy import wer
final_file = open('wer_test.text', "w")
ranges1 = [line.strip() for line in open(
"/media/data/jh/simple_rnn_disf/rnn_disf_detection/data/disfluency_detection/swda_divisions_disfluency_detectio... | [] |
Adwaith-Rajesh/newsweec | newsweec/utils/_dataclasses.py | f3b66fb6f74cb68be4e716269032db340abe8320 | from dataclasses import dataclass
from dataclasses import field
from time import time
from typing import Any
from typing import Callable
from typing import Dict
from typing import List
from typing import Optional
from typing import Tuple
@dataclass
class NewUser:
"""Deals with the commands the user is currently ... | [((1216, 1250), 'dataclasses.field', 'field', ([], {'default_factory': '(lambda : [])'}), '(default_factory=lambda : [])\n', (1221, 1250), False, 'from dataclasses import field\n'), ((612, 618), 'time.time', 'time', ([], {}), '()\n', (616, 618), False, 'from time import time\n')] |
gwu-libraries/vivo2notld | vivo2notld/definitions/person_definition.py | 3f579f8aad28c60119864757e1fe66c2d64a0149 | from .document_summary import definition as document_summary_definition
from .organization_summary import definition as organization_summmary_definition
definition = {
"where": "?subj a foaf:Person .",
"fields": {
"name": {
"where": "?subj rdfs:label ?obj ."
},
#Contact info... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.