id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
5079951
# -*- coding: UTF-8 -*- import logging from typing import Callable, Union from homeassistant.components.light import ( LightEntity, SUPPORT_EFFECT, ATTR_EFFECT, ) from homeassistant.config_entries import ConfigEntry from homeassistant.const import STATE_ON, CONF_HOST, CONF_PORT from homeassistant.helpers.r...
StarcoderdataPython
6584538
<reponame>ryanstwrt/FRIDGE import fridge.Assembly.FuelAssembly as FuelAssembly import fridge.Assembly.SmearAssembly as SmearAssembly import fridge.Assembly.Assembly as Assembly import fridge.driver.global_variables as gb import numpy as np global_vars = gb.GlobalVariables() global_vars.read_input_file('A271_Assembly_T...
StarcoderdataPython
27761
<filename>forms/forms/constants.py """Stores constants used as numbers for readability that are used across all apps""" class AdminRoles: """ """ JCRTREASURER = 1 SENIORTREASURER = 2 BURSARY = 3 ASSISTANTBURSAR = 4 CHOICES = ( (JCRTREASURER, 'JCR Treasurer'), (SENIORTREASURER, ...
StarcoderdataPython
1916647
<filename>nabu/processing/processors/__init__.py '''@package processors contains the data processors''' from . import processor, processor_factory, feature_computers
StarcoderdataPython
3331032
<filename>python/crawel/demo.py<gh_stars>0 l = [ ['Apple', 'Google', 'Microsoft'], ['Java', 'Python', 'Ruby', 'PHP'], ['Adam', 'Bart', 'Lisa'] ] for x in l: for i in x: print ("hello:" + i + "\t")
StarcoderdataPython
5067764
import os import re import json import time import hashlib import collections from lazyapi import ApiClient from lazycls import classproperty from .utils import * from .classes import * from .config import KctlContextCfg from kubernetes.client import ApiClient as KubernetesClient class KctlBaseClient: def __init__...
StarcoderdataPython
6430007
class Coffee: coffeeCupCounter = 0 def __init__(self, themilk, thesugar, thecoffeemate): self.milk = themilk self.sugar = thesugar self.coffeemate = thecoffeemate Coffee.coffeeCupCounter = Coffee.coffeeCupCounter +1 print(f"You now have your coffee with {self.milk} milk, ...
StarcoderdataPython
4968654
import random import typing as t import spacy import pytest from spacy.util import minibatch from spacy.training import Example train_data: t.List[t.Tuple[str, t.Dict[str, t.List[t.Tuple[int, int, str]]]]] = [ ("Google has changed the logo of its apps", {"entities": [(0, 6, "ORG")]}), ("Facebook has introduce...
StarcoderdataPython
8070978
# Generated by Django 2.1 on 2019-02-18 21:31 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0001_initial'), ] operations = [ migrations.AddField( model_name='historicalprofile', name='date_verified', ...
StarcoderdataPython
8045717
from fusion import * import torchvision.datasets as dset from lucchi import LucchiPPDataset, Resize, Scale from torch.utils import data import torch from torch.autograd import Variable from torchvision import utils as v_utils from torchvision import transforms import argparse, os from tqdm import tqdm from tensorboardX...
StarcoderdataPython
3323796
import json import unittest from ExternalAPIs.NIH_NCBI import NIH_NCBI class TestNIH_NCBI(unittest.TestCase, NIH_NCBI): #---------------------------------------------------- # test_NIHFundingDetailsPayload: # Generate POST request payloads for 2 examples in the NIH reporter API documentation. # Check ...
StarcoderdataPython
159769
<filename>reviewboard/accounts/tests/test_privacy_form.py """Unit tests for reviewboard.accounts.forms.pages.PrivacyForm.""" from __future__ import unicode_literals from django.contrib.auth.models import User from django.test.client import RequestFactory from reviewboard.accounts.forms.pages import PrivacyForm from ...
StarcoderdataPython
1664122
<gh_stars>0 from django.shortcuts import render, redirect, get_object_or_404 from rezerwacje.models import Rezerwacja from .forms import RezerwacjaForm from django.utils import timezone import json def index(request): res = Rezerwacja.objects.all() days = [[], [], [], []] for r in res: if r.data_pr...
StarcoderdataPython
9645193
<gh_stars>1-10 # -*- coding: utf-8 -*- """Grammar definition for C files.""" from __future__ import annotations import logging from typing import Generator from pyparsing import * from ..abstract_grammar import AbstractGrammar class Grammar(AbstractGrammar): """Grammar definition for C files.""" ...
StarcoderdataPython
4963982
# engineer_number module # # Copyright (c) 2012-2017 梅濁酒(umedoblock) # # This software is released under the MIT License. # https://github.com/umedoblock/engineer_number import os import sys import unittest from test import support sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..")) from engineer_...
StarcoderdataPython
3387646
<filename>fairseq/models/retrosys.py from argparse import ArgumentParser, ArgumentTypeError, ArgumentError, Namespace from dataclasses import dataclass, _MISSING_TYPE, MISSING from enum import Enum from fairseq.modules.multihead_attention import MultiheadAttention from fairseq.models.transformer import Embedding, Trans...
StarcoderdataPython
3480775
<filename>pysyrenn/frontend/tests/conv2d_layer.py """Tests the methods in conv2d_layer.py """ import numpy as np import torch from external.bazel_python.pytest_helper import main from pysyrenn.frontend.strided_window_data import StridedWindowData from pysyrenn.frontend.conv2d_layer import Conv2DLayer def test_compute(...
StarcoderdataPython
9686463
import numpy as np import matplotlib.gridspec as gridspec from matplotlib import pyplot as plt data_dict = pc._extract_powder_lines(fit_tth_tol=1.0) # %% sample plot to check fit line poistions ahead of fitting frows = int(np.ceil(np.sqrt(instr.num_panels))) fcols = int(np.floor(np.sqrt(instr.num_panels))) fig, ax ...
StarcoderdataPython
3217580
# ext/declarative/clsregistry.py # Copyright (C) 2005-2020 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """Routines to handle the string class registry used by declarative. ...
StarcoderdataPython
277497
from __future__ import annotations import os import secrets import socket import stat from ipaddress import ip_address from typing import Optional def bind_socket(host: str, port: int, *, backlog=100) -> socket.socket: """Create TCP server socket. :param host: IPv4, IPv6 or hostname may be specified :pa...
StarcoderdataPython
380524
<reponame>mhubl/botrecon from botrecon import botrecon botrecon()
StarcoderdataPython
6436265
import math import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.utils import _pair, _quadruple class MedianPool2d(nn.Module): """ Median pool (usable as median filter when stride=1) module. Args: kernel_size: size of pooling kernel, int or 2-tuple st...
StarcoderdataPython
4936142
# Copyright 2014-2016 Insight Software Consortium. # Copyright 2004-2008 <NAME>. # Distributed under the Boost Software License, Version 1.0. # See http://www.boost.org/LICENSE_1_0.txt """ provides low-level functionality, needed to undecorate\demangle compiler generated unique names and map them to the declara...
StarcoderdataPython
4985313
<gh_stars>0 import torch import numpy as np import torch.nn.functional as F from torch_scatter import scatter def _similarity(h1: torch.Tensor, h2: torch.Tensor): h1 = F.normalize(h1) h2 = F.normalize(h2) return h1 @ h2.t() def nt_xent_loss(h1: torch.FloatTensor, h2: torch.FloatTensor, ...
StarcoderdataPython
3364307
<reponame>lextoumbourou/plugin.video.rsa import requests from BeautifulSoup import BeautifulSoup BASE_URL = 'http://comment.rsablogs.org.uk/videos/page/' VIDEO_PAGE_URL = ( 'http://www.thersa.org/events/video?result_4377_result_page={0}' ) RSA_ANIMATE_PAGE_URL = 'http://www.thersa.org/events/rsaanimate' RSA_SHORTS...
StarcoderdataPython
102481
<filename>test/testPicExif.py<gh_stars>1-10 # -*- coding: UTF-8 -*- import unittest from picture_category import pic_exif class TestPicExif(unittest.TestCase): def setUp(self): self.picFile = 'F:\\DCIM\\100ANDRO\\DSC_0004.JPG' def tearDown(self): self.picFile = None def testGetExif(self)...
StarcoderdataPython
8198061
# -*- coding: utf-8 -*- # # (c) Copyright 2003-2015 HP Development Company, L.P. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any late...
StarcoderdataPython
3347900
import os import random as rnd from PIL import Image, ImageFilter from trdg import computer_text_generator, background_generator, distorsion_generator try: from trdg import handwritten_text_generator except ImportError as e: print("Missing modules for handwritten text generation.") class FakeTextDataGenera...
StarcoderdataPython
3352835
<filename>elkm1_lib/lights.py """Definition of an ElkM1 Light""" from .const import Max, TextDescriptions from .elements import Element, Elements from .message import add_message_handler, ps_encode, pc_encode, pf_encode, \ pn_encode, pt_encode class Light(Element): """Class representing a Li...
StarcoderdataPython
12804716
import torch from torch import nn class TextualEncoding(nn.Module): def __init__(self, cfg): super(TextualEncoding, self).__init__() self.cfg = cfg txt_input_size = cfg.TXT_INPUT_SIZE # 300 self.txt_hidden_size = cfg.TXT_HIDDEN_SIZE # 512 self.bidirectional = cfg.RNN.BIDI...
StarcoderdataPython
4902746
import numpy as np import pandas as pd import collections import os import shutil from . import database, data_exploration, baseline, analysis """ use with command : nosetests --with-coverage --cover-package=. test.py """ # database tests TEST_SIZE = 50 TRAIN_SIZE = 280 VALID_SIZE = 139 import pkg_resources DATAFO...
StarcoderdataPython
11392209
from codecs import open from os import path from setuptools import setup, find_packages from subprocess import check_output import sphinx_markdown_parser here = path.abspath(path.dirname(__file__)) check_output( 'pandoc --from=markdown --to=rst --output=' + path.join(here, 'README.rst') + ' ' + path.join(here...
StarcoderdataPython
32402
import logging import threading import time from pajbot.managers.db import DBManager from pajbot.managers.schedule import ScheduleManager from pajbot.models.songrequest import SongrequestQueue, SongrequestHistory, SongRequestSongInfo from pajbot.models.user import User log = logging.getLogger("pajbot") WIDGET_ID = ...
StarcoderdataPython
5079539
from math import trunc n = float(input('Insira um número Real: ')) result = math.trunc(n) print('o valor digitado foi {} e sua porção inteira é : {}'.format(n, result))
StarcoderdataPython
9739338
"""Test SMHI component setup process.""" from smhi.smhi_lib import APIURL_TEMPLATE from homeassistant.components.smhi.const import DOMAIN from homeassistant.core import HomeAssistant from . import ENTITY_ID, TEST_CONFIG from tests.common import MockConfigEntry from tests.test_util.aiohttp import AiohttpClientMocker ...
StarcoderdataPython
9755196
<filename>day1/day1_part2.py #!/usr/bin/env python3 import os with open("input.txt") as f: texts = f.readlines() nums = [int(x) for x in texts] leng=len(nums) print("There are ", leng, " numbers in input." ) for i in range(0,leng): for j in range(i-1,leng): for k in range(j-1,leng): sum...
StarcoderdataPython
1991004
<reponame>kostik/vrs # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import birth_registration.fields import birth_registration.validators class Migration(migrations.Migration): dependencies = [ ('birth_registration', '0026_auto_20150921_1654'), ...
StarcoderdataPython
6424568
""" default setting configurations each constant is set to its equivalent in environment variables or hardcoded default below """ import os import sys # --------------- Map -------------- # MAP_PATH = os.environ.get("MAP_PATH", None) or os.path.join( os.path.dirname(os.path.abspath(__file__)), "maps", "map9.j...
StarcoderdataPython
202290
constants.physical_constants["proton Compton wavelength"]
StarcoderdataPython
1789032
<reponame>muffinresearch/solitude # -*- coding: utf-8 -*- import mock from nose.tools import eq_ import test_utils from ..client import (Client, ClientMock, ClientProxy, dict_to_mock, get_client, response_to_dict) from ..constants import OK, ACCESS_DENIED from ..errors import AuthError, BangoErro...
StarcoderdataPython
1836691
#------------------------------------------------------------------------------- # Parser for ASDL [1] definition files. Reads in an ASDL description and parses # it into an AST that describes it. # # The EBNF we're parsing here: Figure 1 of the paper [1]. Extended to support # modules and attributes after a product. W...
StarcoderdataPython
5072277
<reponame>AutonomyLab/obzerver<gh_stars>1-10 #!/usr/bin/env python from __future__ import print_function import sys import string import numpy def main(): if len(sys.argv) < 2: print("Usage: ./analyze-perf-result.py perf_file1 perf_file_2 ...", file=sys.stderr) sys.exit(1) data = dict() ...
StarcoderdataPython
1649993
# DRUNKWATER TEMPLATE(add description and prototypes) # Question Title and Description on leetcode.com # Function Declaration and Function Prototypes on leetcode.com #172. Factorial Trailing Zeroes #Given an integer n, return the number of trailing zeroes in n!. #Note: Your solution should be in logarithmic time comple...
StarcoderdataPython
11260681
<reponame>ALFA-group/neural_program_comprehension ringos, orenjis = 3, 8 if ringos == orenjis: print(ringos + orenjis) elif abs(ringos - orenjis) == 5 or (ringos + orenjis) == 5: print(ringos*orenjis) else: print(ringos - orenjis)
StarcoderdataPython
6523037
# coding=utf-8 # Copyright 2022 The Uncertainty Baselines 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 ap...
StarcoderdataPython
1781651
<reponame>coverwallet/pysoni<gh_stars>1-10 from time import sleep from datetime import datetime from psycopg2.extras import execute_values from pandas import DataFrame, to_datetime, notnull from toolz import groupby from . import helpers from .connection import Connection class Postgre(object): """This class wi...
StarcoderdataPython
3574014
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright Kitware Inc. and Epidemico Inc. # # Licensed under the Apache License, Version 2.0 ( the "License" ); # you may not use this file except in compliance with the License. # You ma...
StarcoderdataPython
6531885
""" To install, change to this directory and do: sudo python setup.py install """ from distutils.core import setup setup(name='navboxplus', version='1.0', description="An Unscented Estimation and Adaptive Control Package", author="<NAME>", packages=['navboxplus'])
StarcoderdataPython
1844145
"""Module containing factory class for building uvicorn app for Galaxy. Information on uvicorn, its various settings, and how to invoke it can be found at https://www.uvicorn.org/. Galaxy can be launched with uvicorn using the following invocation: :: uvicorn --app-dir lib --factory galaxy.webapps.galaxy.fast_f...
StarcoderdataPython
1802433
from server.crud.base import CRUDBase from server.db.models import ProductsTable from server.schemas.product import ProductCreate, ProductUpdate class CRUDProduct(CRUDBase[ProductsTable, ProductCreate, ProductUpdate]): pass product_crud = CRUDProduct(ProductsTable)
StarcoderdataPython
6534681
<gh_stars>0 from typing import Union, Optional import networkx as nx import numpy as np import numpy.typing as npt def check_for_adjacency_matrix(adjacency_matrix: npt.NDArray[np.int_], ) -> bool: if not isinstance(adjacency_matrix, np.ndarray): raise TypeError(f"An adjacency_matrix of type numpy.ndarray...
StarcoderdataPython
9715213
<reponame>dyllllll/tencentcloud-sdk-python<gh_stars>1-10 # -*- coding: utf8 -*- # Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. 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 cop...
StarcoderdataPython
3308249
from glob import glob import matplotlib.pyplot as plt import numpy as np import os from os.path import join from fastsrm.utils import error_source os.makedirs("../figures", exist_ok=True) rc = { "pdf.fonttype": 42, "text.usetex": True, "font.size": 16, "xtick.labelsize": 16, "ytick.labelsize": 16, ...
StarcoderdataPython
11245977
import mock import pytest import types from spackl.db import Postgres, QueryResult from sqlalchemy.engine import ResultProxy from comparator import comps from comparator import SourcePair, Comparator, ComparatorSet from comparator.compare import ComparatorResult from comparator.exceptions import InvalidCompSetExcepti...
StarcoderdataPython
9601238
from setuptools import setup setup( name='clean-folder', version='1.0.0', description='Script sorting tree folders', url='https://github.com/Keshasan/clean-folder', author='<NAME>', author_email='<EMAIL>', license='', entry_points={'console_scripts': ['clean-folder = clean_folder.clean_...
StarcoderdataPython
3496712
<reponame>Leo-xxx/DenseNAS from tools.collections import AttrDict __C = AttrDict() cfg = __C __C.net_config="""[[16, 16], 'mbconv_k3_t1', [], 0, 1]| [[16, 24], 'mbconv_k5_t3', ['mbconv_k5_t3', 'mbconv_k3_t3'], 2, 2]| [[24, 48], 'mbconv_k5_t6', [], 0, 2]| [[48, 80], 'mbconv_k5_t6', ['mbconv_k7_t3', 'mbconv_k5_t3', 'm...
StarcoderdataPython
1733182
<gh_stars>0 #!/usr/bin/python # simple python socket sender import socket import time HOST = "localhost" # The remote host PORT = 8888 # The same port as used by the server s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) print "Enter 'q' to quit" command = "" while (command != "q"): ...
StarcoderdataPython
9794224
<reponame>antopen/alipay-sdk-python-all<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.TransferCredential import TransferCredential from alipay.aop.api.domain.TransferAddressInfo import TransferAddressInfo from...
StarcoderdataPython
9734622
<filename>www/django/src/templates_django/templates_django/account/__init__.py default_app_config = "templates_django.account.apps.AccountConfig"
StarcoderdataPython
11288448
<gh_stars>0 import math from torchnlp.samplers.bptt_sampler import BPTTSampler class BPTTBatchSampler(object): """Samples sequentially a batch of source and target slices of size ``bptt_length``. Typically, such a sampler, is used for language modeling training with backpropagation through time (BPTT). ...
StarcoderdataPython
4945068
# NsearchQuery # <NAME> from NFixedPointQuery import * from DSGRN.Query.NstableQuery import * class NsearchgoeQuery: def __init__(self, database, goe1, goe2 , bounds1, bounds2): self.database = database c = database.conn.cursor() NFP = NFixedPointQuery(database, *bounds1).mat...
StarcoderdataPython
8076465
<reponame>alexandermerritt/tools #! /usr/bin/env python # Report sizes of all maps by procsses in their virtual address space. import os import re re_pid = re.compile('^[0-9]+') #re_map = re.compile('^([0-9]+|Size|Rss)') re_map = re.compile('^Size') def pids(): dirs = os.listdir('/proc/') dirs2 = [] for ...
StarcoderdataPython
11213493
import asyncio import json from aiocoap import * import time async def main(): uri = "coap://localhost:9100/act-coap" context = await Context.create_client_context() request = Message(code=GET, payload="", uri=uri) response = await context.request(request).response json_p = json.loads(response.p...
StarcoderdataPython
8054695
<reponame>jimmycheng603/katrain import math import threading from kivy.lang import Builder from kivy.metrics import dp from kivy.properties import BooleanProperty, Clock, ListProperty, NumericProperty, StringProperty from kivy.uix.widget import Widget from kivymd.app import MDApp from katrain.gui.theme import Theme ...
StarcoderdataPython
8033088
<reponame>smokah420/StakeCubeCoin<filename>contrib/auto_gdb/log_size.py #!/usr/bin/env python3 # try: import gdb except ImportError as e: raise ImportError("This script must be run in GDB: ", str(e)) import traceback import datetime import sys import os import common_helpers sys.path.append(os.getcwd()) clas...
StarcoderdataPython
73034
<filename>wiki/admin.py<gh_stars>1-10 from django.contrib import admin from .models import WikiPage admin.site.register(WikiPage)
StarcoderdataPython
3263367
#!/usr/bin/env python """ Multi-Resolution (2) Binary Classification with underline Gaussian Distributions <NAME> & <NAME>, Electrical and Computer Engineering Dept., University of Maryland """ #%% Import Modules import pickle import numpy as np # import pandas as pd import matplotlib.pyplot as plt # fr...
StarcoderdataPython
8193413
<gh_stars>0 import pymongo import gridfs from .datastore import DataStore class MongoDBDataStore(pymongo.MongoClient, DataStore): db_name = 'librarypaste' @property def db(self): return self[self.db_name] @classmethod def from_uri(cls, uri): store = cls(uri) uri_p = pymo...
StarcoderdataPython
3551391
<gh_stars>1-10 import xml.etree.ElementTree as ET import sys, csv tree = ET.parse(sys.argv[1]) root = tree.getroot() from constants import * relations = ['collectionobjects2storagelocations', 'collectionobjects2people'] cspaceCSV = csv.writer(open('entities.csv', 'wb'), delimiter='\t') entities = {} for cluedoEleme...
StarcoderdataPython
18968
<reponame>Kreastr/SmartAPI-HEILA import sys import site import os
StarcoderdataPython
394734
# Generated by Django 2.2.3 on 2019-08-01 17:35 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('app', '0021_auto_20190607_1706'), ] operations = [ migrations.RenameModel( old_name='Mot', new_name='Expression', ),...
StarcoderdataPython
1745173
#!/usr/bin/env python # -*- coding: utf-8 -*- """Exercise 10.6 from Kane 1985.""" from __future__ import division from sympy import symbols from sympy.physics.mechanics import ReferenceFrame, RigidBody, Point from sympy.physics.mechanics import dot, dynamicsymbols, inertia, msprint q1, q2, q3 = dynamicsymbols('q1, q...
StarcoderdataPython
5143272
<reponame>Sheldongg/Led3D-master import math import numpy as np def rret(data,size_x,size_y): x = data[:, 0] y = data[:, 1] z = data[:, 2] x= np.array(x) max_x = max(x) min_x = min(x) max_y = max(y) min_y = min(y) min_z = min(z) max_z = max(z) range_x = max_x - min_x ra...
StarcoderdataPython
11247901
<reponame>JSzymanskiJS/trading-bot<gh_stars>0 API_KEY = '<your key>' API_SECRET = '<your secret>'
StarcoderdataPython
3272281
import numpy as np import pandas as pd import neurokit as nk import matplotlib.pyplot as plt import scipy import biosppy import mne import seaborn as sns df = pd.read_csv("https://raw.githubusercontent.com/neuropsychology/NeuroKit.py/master/examples/Bio/bio_100Hz.csv") ecg=df["ECG"] rsp=df["RSP"] sampling_rate=100 ...
StarcoderdataPython
1783253
<gh_stars>1-10 # type: ignore ### Standard imports. ### import os import curses import pickle ### Local imports. ### from src_scripts.utilities import (reader, unpickler) if __name__ == '__main__': import argparse import textwrap ####################################...
StarcoderdataPython
4852345
<reponame>the-gamecoders/TheGameHub<filename>src/signup.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'signup.ui' # # Created by: PyQt5 UI code generator 5.15.1 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unl...
StarcoderdataPython
8131122
<reponame>grahamguthrie99/ai-dfs-dff-scraper import connexion import six from datetime import date, datetime import pytz from swagger_server.models.player_list import PlayerList # noqa: E501 from swagger_server.models.dff_scraper import DFFScraper from swagger_server import util def get_date(): # noqa: E501 """...
StarcoderdataPython
5035091
<filename>malaria24/ona/tests/base.py import pkg_resources import random from datetime import datetime import pytz import responses from django.test import TestCase, override_settings from django.utils import timezone from malaria24.ona.models import ( ReportedCase, Actor, EHP, CASE_INVESTIGATOR, MIS, Facility) ...
StarcoderdataPython
3590154
"""Tests for functions generating random linear systems.""" import numpy as np import pytest import scipy.stats from probnum import randvars from probnum.problems.zoo.linalg import random_linear_system, random_spd_matrix def test_custom_random_matrix(rng: np.random.Generator): random_unitary_matrix = lambda rng...
StarcoderdataPython
107011
from pickle import load from numpy import array from numpy import argmax from keras.preprocessing.text import Tokenizer from keras.preprocessing.sequence import pad_sequences from keras.models import load_model from nltk.translate.bleu_score import corpus_bleu import sys import pika import os import urllib.parse # Pa...
StarcoderdataPython
216689
#! /usr/bin/python HOME_PATH = './' CACHE_PATH = '/var/cache/obmc/' FLASH_DOWNLOAD_PATH = "/tmp" GPIO_BASE = 320 SYSTEM_NAME = "Garrison" ## System states ## state can change to next state in 2 ways: ## - a process emits a GotoSystemState signal with state name to goto ## - objects specified in EXIT_STATE_DEPE...
StarcoderdataPython
1989034
"""Question Class for quora question.""" from quora.content import Content class Question: def __init__(self, data_dict): self.id = data_dict.get("id") self.qid = data_dict.get("qid") self.url = "https://www.quora.com" + data_dict.get("url") self.title = Content(data_dict.get("tit...
StarcoderdataPython
6687612
<gh_stars>1-10 """ Compares the tables generated by makeMiniAppTable and the corresponding table from the original mini app. """ import csv import sys from tr55.tablelookup import lookup_nlcd # Generate keys from rows that will be used to match rows in the # old and new table. # If transform == True, convert value...
StarcoderdataPython
6513090
# __init__.py: Yet Another Bayes Net library # Contact: <NAME> ( <EMAIL> ) """ For detailed documentation and examples, see the README. """ # Make our dependencies explicit so compiled Cython code won't segfault trying # to load them. import networkx, matplotlib.pyplot, scipy import numpy as np import os import pyxi...
StarcoderdataPython
4899653
<filename>Methods/Machine/LamSquirrelCage/build_geometry.py<gh_stars>1-10 # -*- coding: utf-8 -*- """@package build_geometry @date Created on août 10 10:42 2018 @author franco_i """ def build_geometry(self, sym=1, alpha=0, delta=0, is_simplified=False): """Build geometry of the LamSquirrelCage Parameters ...
StarcoderdataPython
11397238
# -*- coding: utf-8 -*- # # Copyright © 2009 <NAME> # Licensed under the terms of the MIT License """ MatplotlibWidget ================ Example of matplotlib widget for PyQt4 Copyright © 2009 <NAME> This software is licensed under the terms of the MIT License Derived from 'embedding_in_pyqt4.py': Copyright © 2005 <NAM...
StarcoderdataPython
3547852
<reponame>loumir/modelinstanceinvot-code ''' Created on 31 mars 2020 @author: laurentmichel ''' from astropy.io.votable import parse from client.inst_builder import logger, table_mapper from client.translator.instance_from_votable import InstanceFromVotable from client.translator.json_mapping_builder import JsonMappin...
StarcoderdataPython
3372576
<reponame>guionardo/py-cache-guiosoft import os import unittest from unittest.mock import Mock, patch from cache_gs.cache_classes.cache_data_file import CacheData, CacheDataFile from tests.test_tools import raise_test_exception def force_exception(*args, **kwargs): raise_test_exception() class TestCacheDataFil...
StarcoderdataPython
1858215
from forms.registerForm import UserForm from django.shortcuts import render, redirect from django.template.loader import render_to_string from django.contrib.auth import ( authenticate, login, logout, ) from django.views.generic import DetailView, ListView from forms.loginForm import UserLoginForm from Stor...
StarcoderdataPython
9660991
# -*- coding: utf-8 -*- # Define here the models for your spider middleware # # See documentation in: # https://docs.scrapy.org/en/latest/topics/spider-middleware.html import random from scrapy import signals from scrapy.exceptions import NotConfigured import redis class XpcSpiderMiddleware: # Not all methods ne...
StarcoderdataPython
1828798
<reponame>zeshinsei/sync-companion import configparser import sys import reddit ### Return the current subreddit name ### def get_subreddit(): return sys.argv[1] ### Read from the config ### def get_config(): config = configparser.ConfigParser() s = reddit.reddit.subreddit(get_subreddit()) configdata = s....
StarcoderdataPython
1719862
# -*- coding: utf-8 -*- """ @brief: Extract judicial acts from `bsr.sudrf.ru` (update database) @package: judicial @file: settings.py @author: dmryutov (<EMAIL>) @version: 1.0 @date: 03.11.2017 -- 04.11.2017 """ import re import os # Links to all acts ALL_ACTS = r'https://bsr.sudrf.ru/bigs/portal.html#%7B%22m...
StarcoderdataPython
9766330
<filename>gauto/common/protocol.py # -*- 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 complianc...
StarcoderdataPython
6609283
# 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 ...
StarcoderdataPython
3368679
<reponame>jasonwbarnett/pycal-play #!/usr/bin/env python3 from datetime import datetime a_meetings = [['09:00', '10:30'], ['12:00', '13:00'], ['16:00', '18:00']] a_workday = ['09:00', '20:00'] a_meetings = [['10:00', '11:30'], ['12:30', '14:30'], ['14:30', '15:00'], ['16:00', '17:00']] a_workday = ['10:00', '18:30'] ...
StarcoderdataPython
1828140
<reponame>imranq2/SparkAutoMapper.FHIR from __future__ import annotations from spark_auto_mapper_fhir.fhir_types.uri import FhirUri from spark_auto_mapper_fhir.value_sets.generic_type import GenericTypeCode from spark_auto_mapper.type_definitions.defined_types import AutoMapperTextInputType # This file is auto-gene...
StarcoderdataPython
11353657
from setuptools import setup, Extension import setuptools_scm # noqa Ensure it’s installed extensions = [ Extension("cutadapt._align", sources=["src/cutadapt/_align.pyx"]), Extension("cutadapt.qualtrim", sources=["src/cutadapt/qualtrim.pyx"]), ] setup(ext_modules=extensions)
StarcoderdataPython
12170
import asyncio import logging import traceback import uuid from typing import Optional, Tuple, Any, Callable from pesto.ws.core.payload_parser import PayloadParser, PestoConfig from pesto.ws.core.pesto_feature import PestoFeatures from pesto.ws.core.utils import load_class, async_exec from pesto.ws.features.algorithm_...
StarcoderdataPython
8038043
<filename>Chapter07/original_images_example.py from tensorflow.examples.tutorials.mnist import input_data import matplotlib.pyplot as plt mnist = input_data.read_data_sets('MNIST_data', one_hot = True) class OriginalImages: def __init__(self): pass def main(self): X_train, X_test = self.st...
StarcoderdataPython