id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
4953996 | <filename>mopidy_radio_pi/data/radiopidb.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sqlite3 as lite
import sys
con = lite.connect('radiopi.db')
with con:
cur = con.cursor()
#cur.execute("DROP TABLE IF EXISTS Tracklist")
#cur.execute("CREATE TABLE Tracklist(Id INTEGER PRIMARY KEY, ThemeId INT, Pl... | StarcoderdataPython |
4981208 | # -*- coding: utf-8 -*-
# @Author: <NAME>
# @E-mail: <EMAIL>
# @Date: 2020-04-21 13:39:27
# @Last Modified by: <NAME>
# @Last Modified time: 2020-06-01 17:49:46
import os
import argparse as ap
from MAESTRO.scATAC_H5Process import *
from MAESTRO.scRNA_QC import scrna_qc
def scrna_analysis_parser(subparsers):
... | StarcoderdataPython |
3293973 | <filename>python/migration.py<gh_stars>0
import requests
from requests_oauthlib import OAuth1
import json
from QBO_request import api_call
with open('config.json', 'r') as f:
config = json.load(f)
def migrate_tokens():
'''Migrate tokens from OAuth1 to OAuth2'''
headers = { 'Content-Type': 'application/jso... | StarcoderdataPython |
3387398 | <filename>SDK & Exmaples/examples/python/USB2GPIO/USB2GPIO_Test/USB2GPIO_Test.py<gh_stars>0
#-*- coding: utf-8 -*-
from ctypes import *
import platform
from time import sleep
from usb_device import *
from usb2gpio import *
if __name__ == '__main__':
DevHandles = (c_int * 20)()
DevHandle = 0
# Scan device
... | StarcoderdataPython |
4800076 | #!/usr/bin/env python3
import csv
import os
import time
import sys
from datetime import datetime
from sys import platform
try:
from bs4 import BeautifulSoup
import requests
except:
sys.exit(sys.argv[0] + "maybe 'pip install requests bs4' first, then do a 'pip install bs4' then try again.")
url = "http://www.bsp... | StarcoderdataPython |
6426866 | def strong_prefix_suffix(w, m):
sB, t = [-1] + [0] * m, -1
for i in range(1, m + 1): # niezmiennik: t = B[i - 1]
while t >= 0 and w[t + 1] != w[i]:
t = sB[t]
t = t + 1
if i == m or w[t + 1] != w[i + 1]:
sB[i] = t
else:
sB[i] = sB[t]
return sB | StarcoderdataPython |
9782108 | <gh_stars>1-10
#!/usr/bin/python3
# Generate svg rectangles from coordinate quadruples
# author: <NAME> <<EMAIL>>
# usage: python3 quad2svg.py [-s SHIFTX SHIFTY -d DELIMITER] RECTCOORDFILENAME > OUTPUTRECT.svgfrac
# svgfrac is incomplete svg file, they should be appended in the <g></g> tag in a svg file.
# SHIFTX & SHI... | StarcoderdataPython |
246689 | <reponame>feilaoda/espider<gh_stars>1-10
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import os
import imp
import hashlib
class TestClass(object):
"""docstring for TestClass"""
def __init__(self, arg):
super(TestClass, self).__init__()
self.arg = arg
def md5str(url):
if type(url... | StarcoderdataPython |
3262011 | <gh_stars>1-10
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from .encoder import Encoder
from src.modules.nn_layers import *
from src.utils.args import args
class DensenetEncoder(Encoder):
def __init__(self, output_dim, input_shape):
super().__init__()
nc = inp... | StarcoderdataPython |
11318257 | # python2.6
# -*- coding: utf-8 -*-
# RFC 3720 (iSCSI) protocol implementation for conformance testing.
"""
iSCSI header definitions and constructor interfaces.
"""
from struct import Struct
from collections import namedtuple
from pycopia.iscsi.constants import *
## Field objects ##
class FieldBase(object):
... | StarcoderdataPython |
1841529 | # private keys
x = 91
y = 71
# public keys
g = 13
n = 27
my_public = pow(g,x,n)
your_public = pow(g,y,n)
my_key = pow(your_public,x,n)
your_key = pow(my_public, y,n)
print(my_key, your_key)
| StarcoderdataPython |
5099974 | <gh_stars>0
"""
Java exception thrown for non-keyword argument following keyword
"""
def parrot(**args):
pass
parrot(voltage=5.0, 'dead')
| StarcoderdataPython |
9638203 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import etcd
# 1、初始化客户端
# 默认配置是(host='127.0.0.1', port=4001),etcd部署默认的配置是2379
# client = etcd.Client() # this will create a client against etcd server running on localhost on port 4001
# client = etcd.Client(port=4002)
client = etcd.Client(host='127.0.0.1', p... | StarcoderdataPython |
1977243 | <filename>GA.py
####### PART 1.A - EA #######
# Name : <NAME>
# Student ID : HW00281038
# Date : Oct. 1st 2017
##############################
import random
import math
import numpy as np
import itertools
import copy
import time
import pandas as pd
import matplotlib.pyplot as plt
import pro... | StarcoderdataPython |
3287583 | <filename>imagepy/menus/Plugins/Manager/toltree_wgt.py
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 16 21:13:16 2017
@author: yxl
"""
from imagepy.core.engine import Free
import wx,os
from imagepy import root_dir
from imagepy.core.app import loader
from wx.py.editor import EditorFrame
from sciapp import Source
#fro... | StarcoderdataPython |
6469277 | """
This module contains low-level APIs that are very generic and could be used in many
different applications.
""" | StarcoderdataPython |
6608986 | <gh_stars>1-10
"""create table for cm load insert queries
Revision ID: 053659c382dc
Revises: <KEY>
Create Date: 2018-12-01 12:46:48.608877
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '053659c382dc'
down_revision = '<KEY>'
branch_labels = None
depends_on = N... | StarcoderdataPython |
4884559 | #!/usr/bin/env python3
# The Elves quickly load you into a spacecraft and prepare to launch.
#
# At the first Go / No Go poll, every Elf is Go until the Fuel Counter-Upper. They haven't determined the amount of fuel required yet.
#
# Fuel required to launch a given module is based on its mass. Specifically, to find the... | StarcoderdataPython |
1909355 | from .job_click_message import JobClick
from .root_click_message import RootClick
__all__ = ("JobClick", "RootClick")
| StarcoderdataPython |
1851617 | # -*- coding: utf-8 -*-
"""Top-level package for nuclei."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.0'
| StarcoderdataPython |
6603330 | <reponame>jonasfreyr/Net-forritun
import socket
import urllib.request
HOST = '127.0.0.1' # Standard loopback interface address (localhost)
PORT = 65432 # Port to listen on (non-privileged ports are > 1023)
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.bind((HOST, PORT))
s... | StarcoderdataPython |
8004891 | def square(x):
'''
x: int or float.
'''
return x**2
def fourthPower(x):
'''
x: int or float.
'''
square(x)*square(x)
return x
| StarcoderdataPython |
5194246 | <reponame>jakejhansen/minesweeper_solver<filename>q_learning/backup_output_net1_discount_0_batch_400_best/test_environments_step.py
from environments import *
# Just shows some game-play of an agent
#env = AtariGymEnvironment(display=True, game="BeamRider-v0")
#env.new_random_game_play() | StarcoderdataPython |
9651372 | from vint.linting.policy_loader import register_policy
@register_policy
class PolicyFixture2(object):
pass
| StarcoderdataPython |
12806958 | import logging
import re
import sys
from jinja2 import Environment, FileSystemLoader
from jupyter_core.application import JupyterApp, NoStart
from tornado.log import LogFormatter
from tornado.web import RedirectHandler
from traitlets import Any, Bool, Dict, HasTraits, List, Unicode, default
from traitlets.config impor... | StarcoderdataPython |
1865781 | <gh_stars>1-10
import json
import os
from collections import defaultdict
path = '/home/manuto/Documents/world_bank/bert_twitter_labor/twitter-labor-data/data/evaluation_metrics/US/diversity/threshold_calibrated_distance_with_seed'
json_list = os.listdir(path)
final_dict = defaultdict(set)
for json_file in json_list:
... | StarcoderdataPython |
5084788 | <reponame>MrMikeWolf/F16Dynamics<gh_stars>1-10
from trim_f16 import cost_trim_f16
from params_f16 import load_f16
from engine_f16 import tgear
from eqm import eqm
from scipy.optimize import minimize
import pandas as pd
from scipy.integrate import odeint
from numpy import arange, sin, cos
import matplotlib.pyplot as plo... | StarcoderdataPython |
289824 | # Python script that parses an OpenJ9 javacore and displays
# the number of classes in SCC and outside SCC.
# Depending on the configuration it will also print
# all classes that were shared (in SCC) or not shared
# If `displayClassLoaderHierarchy` is `True` we also print all the unique (by name)
# class hierarchies th... | StarcoderdataPython |
6595730 | <reponame>urso/clidec
import argparse
class _namespaced:
"""
All objects implementing _namespaced can be used as namespaces
for adding sub commands.
"""
def __init__(self):
self._subcommands = {}
def namespace(self, name, *opts):
""" Create new sub-namespace without runnable ... | StarcoderdataPython |
3463721 | <reponame>ysidharthjr/CalculaThor
#!/usr/bin/env python3
from tkinter import *
from tkinter import messagebox
import math
root=Tk()
for x in range(5):
Grid.rowconfigure(root, x, weight=1)
for y in range(7):
Grid.columnconfigure(root, y, weight=1)
root.title("Calcula-Thor")
l1=Label(root,text="Calcula-Thor",f... | StarcoderdataPython |
8008917 | <gh_stars>1-10
import hashlib
class Image:
def __init__(self, tag, size_within=None, image_format=None):
self._tag = tag
self._size_within = size_within
self._image_format = image_format
@property
def tag(self):
"""
The tag of this image.
:rtype : str
... | StarcoderdataPython |
9663956 | #!/usr/bin/env python
import sys
from deep_learning_service import DeepLearningService
sys.path.append('./inference')
dl_service = DeepLearningService()
dl_service.load_all_models()
| StarcoderdataPython |
6538091 | <gh_stars>0
import unittest # Importing the unittest module
from user import User
from credential import Credential
import pyperclip
class TestUser(unittest.TestCase):
'''
A test class that defines test cases for the user class behaviours.
Args:
unittest.TestCase: TestCase class that helps i... | StarcoderdataPython |
128710 | <reponame>stvgt/interfaces
SQL_INIT_TABLES_AND_TRIGGERS = '''
CREATE TABLE consumers
(
component TEXT NOT NULL,
subcomponent TEXT NOT NULL,
host TEXT NOT NULL,
itype TEXT NOT NULL,
iprimary TEXT NOT NULL,
isecondary TEXT NOT NULL,
itertiary TEXT NOT NULL,
... | StarcoderdataPython |
5004677 | # The list of candies to print to the screen
candyList = ["Snickers", "Kit Kat", "Sour Patch Kids", "Juicy Fruit", "Sweedish Fish", "Skittles", "Hershey Bar", "Skittles", "Starbursts", "M&Ms"]
# The amount of candy the user will be allowed to choose
allowance = 5
# The list used to store all of the candies selected i... | StarcoderdataPython |
4889742 | <reponame>fabiommendes/sidekick<filename>sidekick-functions/sidekick/functions/fn_interfaces.py
import copy
from collections import ChainMap
from functools import reduce, partial, singledispatch
from itertools import chain
from .core_functions import to_callable
from .fn import fn
from ..typing import T, MutableMappin... | StarcoderdataPython |
3558408 | import unittest
import stabpoly.polynomials as polynomials
import numpy
from sympy import Poly
_EPSILON = 1e-10
class TestPolynomials(unittest.TestCase):
def test_product_polynomial(self):
matrix = numpy.array([[2,1],[1,2]])
polynomial = Poly(polynomials.product_polynomial(matrix))
syms = polynomials.g... | StarcoderdataPython |
8120090 | <reponame>jamshaidsohail5/stattests
from typing import Tuple, Dict, Optional, Set, List
import imageio
import numpy as np
import scipy.stats
import seaborn as sns
from IPython.core.display import HTML
from matplotlib import pyplot as plt
from matplotlib.axes import Axes
from stattests.data import rpv
from stattests.g... | StarcoderdataPython |
8078936 | import tensorflow as tf
var_init = lambda x: tf.variance_scaling_initializer(scale=x, distribution='truncated_normal')
scale = 0.1
class NACCell(object):
def __init__(self, in_dim, out_dim):
with tf.variable_scope('nac-cell') as vs:
self.w = tf.get_variable(name = 'w', shape = [in_dim, out_... | StarcoderdataPython |
244480 | <reponame>fidsusj/HateSpeechDetection
""" Module runs all classifiers in this directory and returns a dataframe with performance metrices """
import multiprocessing
from datetime import datetime
from multiprocessing import Pool
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from classifiers.... | StarcoderdataPython |
1854969 | <reponame>yishayv/lyacorr
import numpy as np
from scipy import signal
class MeanTransmittance:
def __init__(self, ar_z):
self.ar_z = np.copy(ar_z)
self.ar_total_flux = np.zeros_like(self.ar_z)
self.ar_count = np.zeros_like(self.ar_z)
self.ar_weights = np.zeros_like(self.ar_z)
... | StarcoderdataPython |
9672087 | """Multiplication."""
from __future__ import absolute_import, print_function
import nengo
from nengo.dists import Choice
from nengo.processes import Piecewise
import matplotlib.pyplot as plt
# model
model = nengo.Network(label="Multiplication")
with model:
A = nengo.Ensemble(100, dimensions=1, radius=10)
B... | StarcoderdataPython |
345658 | # Copyright 2018 The GraphNets 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 applicabl... | StarcoderdataPython |
8122100 | def main():
from sys import stdin,stdout
from math import sin
for _ in[0]*int(input()):
a,b,c=map(int,stdin.readline().split())
p=0
r=c
while(r-p>0.000009):
q=(p+r)/2
if(a*q+b*sin(q)>c):r=q
else :p=q
print("%.6f"%q)
main()
| StarcoderdataPython |
1908286 | {
"name" : "Product Image",
"version" : "0.1",
"author" : "<NAME>, Rove.design GmbH",
"website" : "http://www.rove.de/",
"description": """
This Module overwrites openerp.web.list.Binary field to show the product image in the listview. A new column with product image is added.
""",
"depends"... | StarcoderdataPython |
3250362 | '''Create charts for viewing on Raspberry Pi Web Server.'''
# Raspi-sump, a sump pump monitoring system.
# <NAME>
# http://www.linuxnorth.org/raspi-sump/
#
# All configuration changes should be done in raspisump.conf
# MIT License -- http://www.linuxnorth.org/raspi-sump/license.htmlimport os
import os
import subproce... | StarcoderdataPython |
373026 | <reponame>NicolasLM/python-runabove
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2014, OVH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation t... | StarcoderdataPython |
28197 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import os.path
import uuid
from yamlfred.utils import remove_default, merge_dicts
from yamlfred.utils import Include
defaults = {
'alfred.workflow.output.notification': {
'config': {'removeextension': False, 'output': 0, 'las... | StarcoderdataPython |
6601550 | <gh_stars>1-10
# -*- coding: utf-8 -*-
'''
Provide instance of analytics to track events and timings.
'''
from mlab_api.analytics.google_analytics import GoogleAnalyticsClient
from mlab_api.app import app
TRACKING_ID = app.config['GA_TRACKING_ID']
ANALYTICS = GoogleAnalyticsClient(TRACKING_ID)
| StarcoderdataPython |
3203421 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import os
import yaml
import necbaas as baas
def load_config():
"""
Load test config from ~/.baas/python_test_config.yaml
Returns:
dict: Loaded config
"""
f = open(os.path.expanduser("~/.baas/python_test_config.yaml"), 'r')
config = yaml.load(f)... | StarcoderdataPython |
369870 | #!/usr/bin/env python3
import json
import os
from armor import Armor
def convert_armor(armor):
armor.sort(key=lambda a: int(a.name), reverse=True)
cols_printed = False
f = "{:<32}\t{:<16}\t{:>2}\t{:>5}\t{:>5}\t{:<16}\t{}"
for a in armor:
if not cols_printed:
print(f.format(
... | StarcoderdataPython |
5060168 | <filename>chap9/ages.py
# Exercise 9.9
# I think the child is 57, and they're 17-18 years apart
# I really shouldn't rewrite functions, but it's a short one and it's more convenient now.
def is_reverse(word1, word2):
return word1==word2[::-1]
# After looking at the solutions, this should really cover reversed num... | StarcoderdataPython |
8194142 | <reponame>Hvedrug/NLP-project-chatbot_writing_web_page
import data
import htmlObject
def generateHTML():
res = htmlObject.createHTML()
for x in data.listID:
#print(x[0])
#print(data.arrayHTML[x[0]])
if data.arrayHTML[x[0]][0] == "p":
res += "<p id=\"" +data.arrayHTML[x[0]][1] +"\" class=\"" +data.a... | StarcoderdataPython |
6454806 | <filename>src/gameview.py
from config import bg_color, resolution, font_size, steps_per_cell
from events import BoardBuiltEvent, BoardUpdatedEvent, RecipeMatchEvent, \
GameBuiltEvent, VTickEvent, FruitKilledEvent, FruitSpeedEvent, FruitPlacedEvent, \
QuitEvent
from fruitspr import FruitSpr
from pygame.rect impo... | StarcoderdataPython |
1868851 | from pyzzle import datasource, etl, recon
from .base_job import JobConfigException | StarcoderdataPython |
1774372 | <reponame>mathieui/twisted
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.trial._dist.disttrial}.
"""
import os
import sys
from twisted.internet.protocol import Protocol, ProcessProtocol
from twisted.internet.defer import fail, gatherResults, maybeDeferred, succeed
fr... | StarcoderdataPython |
321912 | import collections
from xml.sax.saxutils import escape
from census.helpers import domain_from_url, is_chaff_domain, is_known
from census.html_writer import HtmlOutlineWriter
from census.report_helpers import get_known_domains, hash_sites_together, sort_sites
CSS = """\
html {
font-family: sans-serif;
... | StarcoderdataPython |
3462535 | <reponame>chaurwu/DunkIt
import RPi.GPIO as GPIO
import time
import requests
TRIG = 23
ECHO = 24
GPIO.setmode(GPIO.BCM)
GPIO.setup(TRIG, GPIO.OUT)
GPIO.setup(ECHO, GPIO.IN)
print("Start detecting basketballs...")
while True:
GPIO.output(TRIG, False)
# time.sleep(0.01)
GPIO.output(TRIG, True)
time.sleep(0.00... | StarcoderdataPython |
5131568 | <filename>dev.py<gh_stars>1-10
debug = True
xheaders = False
static_path = 'static'
font_file = 'src/cloudplayer/iokit/font/RobotoMono-Regular.ttf'
cookie_file = 'tok_v1.cookie'
allowed_origins = [
'http://localhost:4200',
'http://localhost:8050',
'http://radio.cloud-player.io',
'https://radio.cloud-p... | StarcoderdataPython |
3330764 | <gh_stars>0
import sys
sys.path.insert(0, '..')
from ast_node import ASTNode
class InsertInto(ASTNode):
def __init__(self, table_name, insert_list, line, column):
ASTNode.__init__(self, line, column)
self.table_name = table_name
self.insert_list = insert_list
def execute(self, table,... | StarcoderdataPython |
3472633 | <filename>gehomesdk/erd/values/ac/__init__.py
from .common_enums import *
from .wac_enums import *
from .sac_enums import * | StarcoderdataPython |
6633444 | <gh_stars>0
"""
File: blur.py
Name:黃稚程 mike
-------------------------------
This file shows the original image first,
smiley-face.png, and then compare to its
blurred image. The blur algorithm uses the
average RGB values of a pixel's nearest neighbors
"""
from simpleimage import SimpleImage
def blur(img):
"""
... | StarcoderdataPython |
8011994 | <gh_stars>0
from datetime import date
from django.shortcuts import redirect
class BootstrapFormMixin:
fields = {}
def _init_bootstrap_form_controls(self):
for _, field in self.fields.items():
if not hasattr(field.widget, 'attrs'):
setattr(field.widget, 'attrs', {})
... | StarcoderdataPython |
5181970 | <gh_stars>1-10
from zabbix_enums.common import _ZabbixEnum
class ItemAllowTraps(_ZabbixEnum):
NO = 0
YES = 1
class ItemFollowRedirects(_ZabbixEnum):
NO = 0
YES = 1
class ItemVerifyHost(_ZabbixEnum):
NO = 0
YES = 1
class ItemVerifyPeer(_ZabbixEnum):
NO = 0
YES = 1
class ItemAuth... | StarcoderdataPython |
48803 | import shared_module
from shared_module import module_function as my_function, ModuleClass
class NewParent(object):
def do_useful_stuff(self):
i = shared_module.MODULE_CONTANT
my_function()
ModuleClass() | StarcoderdataPython |
244314 | """
Purpose: To simulate expected educational attainment gains from embryo selection between families.
Date: 10/09/2019
"""
import numpy as np
import pandas as pd
from scipy.stats import norm
from between_family_ea_simulation import (
get_random_index,
get_max_pgs_index,
select_embryos_by_index,
calc_... | StarcoderdataPython |
9614295 | <gh_stars>1-10
#!/bin/env python3
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
def parse_requirements(requirements):
with open(requirements) as reqf:
items = [line.strip("\n") for line in reqf if not line.startswith("#")]
return list(filter(lambda s: s.strip() != "", items))
setup(
... | StarcoderdataPython |
321651 | <reponame>fisabiliyusri/proxy
# -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by <NAME> and contributors.
:li... | StarcoderdataPython |
12803735 | import copy
import collections
import inspect
import itertools
import sys
import time
import types
import uuid
from pyevents.event import Event
from pyevents.manager import EventDispatcher
from specter.util import (
get_real_last_traceback, convert_camelcase, find_by_metadata,
extract_metadata, children_with_t... | StarcoderdataPython |
249553 | import collections
import inspect
import os.path
import shutil
import sys
from functools import wraps
# inspired by: http://stackoverflow.com/a/6618825
def flo(string):
'''Return the string given by param formatted with the callers locals.'''
callers_locals = {}
frame = inspect.currentframe()
try:
... | StarcoderdataPython |
6405322 | <filename>python/pySimE/space/tests/sapce_elevator.py
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 20 19:47:14 2013
@author: asiJa
"""
# ==============================================
print 'space elevator'
from sympy import *
import pylab
GM,v,h0,r0,x, s, omega = symbols('GM v h0 r0 x s omega')... | StarcoderdataPython |
9701414 | <reponame>Avik32223/gala-iam-api
from pydantic.error_wrappers import ValidationError
from db.database import Database
from models.base_record_manager import BaseRecordManager
from models.resource.resource_manager import ResourceManager
from models.resource_action.resource_action_manager import \
ResourceActionMana... | StarcoderdataPython |
3580151 | #!/usr/bin/env python
"""
Data Object
A very generic object intended to be used to store and transmit simple data.
This is similar to using a dict. Hoever, fields are accessed using
attributes, and this is intended to be extended as future needs warrant.
The key to using this module correctly is defining the fields ... | StarcoderdataPython |
9609039 | from dagster_graphql.client.query import START_PIPELINE_EXECUTION_MUTATION, SUBSCRIPTION_QUERY
from dagster_graphql.implementation.context import DagsterGraphQLContext
from dagster_graphql.implementation.pipeline_execution_manager import SubprocessExecutionManager
from dagster_graphql.schema import create_schema
from d... | StarcoderdataPython |
6502232 | <filename>SimpleNeuralNets/Layers/__init__.py
__author__ = 'jotterbach'
| StarcoderdataPython |
3419515 | import logging
LOG = logging.getLogger(__name__)
class ProfileVariantMixin():
def add_profile_variants(self, profile_variants):
"""Add several variants to the profile_variant collection in the
database
Args:
profile_variants(list(models.ProfileVariant))
"""
... | StarcoderdataPython |
1884258 | import re, os
from warnings import warn
class Mutation:
"""
Stores the mutation. Not to be confused with the namedtuple Variant, which stores gnomAD mutations.
>>> Mutation('p.M12D')
>>> Mutation('M12D')
>>> Mutation(gnomAD_variant_instance)
This class does not do analyses with Protein, but Pro... | StarcoderdataPython |
5021746 | <gh_stars>0
'''
hamming distance is the simplest of string comparison algorithms
all it does is look for differences between the two strings
i.e the number of substitutions needed to make the strings match
'''
def hammingDistance(s1, s2):
"""Return the Hamming distance between equal-length sequences"""
if le... | StarcoderdataPython |
6585294 | import json
import requests
import os
import time
import sys
## Pair: BTCUSD, USDBTC, DASHUSD, etc
class PriceRetriever:
def __init__(self):
self.localbitcoins = None
self.gemini = None
self.bitinka = None
self.ripio = None
self.cexio = None
self.coinbase = None
def ask(self):
# print(... | StarcoderdataPython |
11281991 | <reponame>ybdesire/machinelearning
import numpy as np
a = np.array(
[
[1,0,1,0,1,0,1],
[0,0,0,1,1,1,1],
[1,2,1,2,1,2,1],
[2,3,3,3,3,3,3]
]
)
y,x = np.where(a==2)#find the index of 2 in a
print(y,x)
# result is [2 2 2 3] [1 3 5 0], that is
# a[2][1] = 2
# a[2][... | StarcoderdataPython |
1965705 | <filename>abm1559/utils.py
import numpy as np
constants = {
"BASEFEE_MAX_CHANGE_DENOMINATOR": 8,
"TARGET_GAS_USED": 10000000,
"MAX_GAS_EIP1559": 20000000,
"EIP1559_DECAY_RANGE": 800000,
"EIP1559_GAS_INCREMENT_AMOUNT": 10,
"INITIAL_BASEFEE": 1 * (10 ** 9),
"PER_TX_GASLIMIT": 8000000,
"SI... | StarcoderdataPython |
8127922 | <reponame>seberg/pandas
import pandas.core.config as cf
from pandas.core.config import is_int,is_bool,is_text,is_float
from pandas.core.format import detect_console_encoding
"""
This module is imported from the pandas package __init__.py file
in order to ensure that the core.config options registered here will
be avai... | StarcoderdataPython |
197485 | from .stationarybootstrap import Bootstrap
from .crossquantilogram import CrossQuantilogram
from .qtests import BoxPierceQ,LjungBoxQ
from .utils import DescriptiveStatistics
from .api import CQBS,CQBS_alphas,CQBS_years
from .plot import bar_example,heatmap_example,rolling_example
__doc__ = """The `Cross-Quantilogram`(... | StarcoderdataPython |
5158325 | from unittest import TestCase, mock
from src.patch_listitem import app
import pymysql
def good_api_event():
return {
"body": '{ "listItemID": "id", "listItem": "name"}',
"queryStringParameters": None
}
def bad_api_event():
return {
"body": None,
"queryStringParameters": N... | StarcoderdataPython |
1667176 | <filename>test_sched_slack_bot/test_controller.py
import dataclasses
import datetime
import os
import uuid
from typing import List
from unittest import mock
import pytest
from slack_bolt import App
from slack_sdk import WebClient
from sched_slack_bot.controller import AppController
from sched_slack_bot.data.schedule_... | StarcoderdataPython |
1636524 | import os
from typing import Tuple
from typing import Union
import matplotlib.pyplot as plt
import torch.nn.functional as F
from torch import Tensor
from torchvision.transforms import transforms
from auxiliary.utils import correct, rescale, scale
from classes.core.ModelTCCNet import ModelTCCNet
from classes.modules.m... | StarcoderdataPython |
4802238 | <reponame>tharrrk/pydigitemp
"""
Conceptual Overview
-------------------
Properly configured with respect to baud rate, data bits per character, parity and number of stop bits,
a 115,200 bit per second capable UART provides the input and output timing necessary to implement a 1-Wire master.
The UART produces the 1-Wir... | StarcoderdataPython |
9619881 | # Copyright 2014 OpenCore 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,... | StarcoderdataPython |
1879754 | """
Routing registration support.
Intercepts Flask's normal route registration to inject conventions.
"""
from distutils.util import strtobool
from flask_cors import cross_origin
from microcosm.api import defaults
from microcosm_logging.decorators import context_logger
@defaults(
converters=[
"uuid",
... | StarcoderdataPython |
5114052 | from urllib import parse
from urllib.parse import quote
import requests
import xlrd
import os
import piexif
from PIL import Image
import uuid
import json
def help():
print("help ------------------- 帮助选项(查看文档详细信息)")
print("sc [cho] --------------- 搜索数据库信息")
print("de [cho] [name] -------- 删除数据库信息")
print("img [file... | StarcoderdataPython |
5004283 | """
This package contains all Pydantic models used for the Amplitude V1 API
requests and responses.
"""
from .identify import Identification, IdentifyAPIRequest, UserProperties
__all__ = ["Identification", "IdentifyAPIRequest", "UserProperties"]
| StarcoderdataPython |
3346969 | <filename>venv/lib/python3.8/site-packages/hypothesis/internal/validation.py
# This file is part of Hypothesis, which may be found at
# https://github.com/HypothesisWorks/hypothesis/
#
# Most of this work is copyright (C) 2013-2020 <NAME>
# (<EMAIL>), but it contains contributions by others. See
# CONTRIBUTING.rst for ... | StarcoderdataPython |
3373533 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import pdb, importlib, inspect, time, datetime, json
# from PyFin.api import advanceDateByCalendar
# from data.polymerize import DBPolymerize
from data.storage_engine import StorageEngine
import time
import pandas as pd
import numpy as np
from datetime import timedelta, datetime
... | StarcoderdataPython |
3542256 | <gh_stars>1-10
# constants.py
league = 'expedition'
TRADE_BASE_URL = 'https://www.pathofexile.com/api/trade/' | StarcoderdataPython |
9696752 | import numpy as np
import scipy.misc
import urllib.request as urllib
import utils.dataloaders as dataloaders
from models.wideresnet import *
from models.lenet import *
from utils.helpers import *
import methods.entropy.curriculum_labeling as curriculum_labeling
import torch
class Wrapper:
"""
All steps for o... | StarcoderdataPython |
3388624 | from django.views.generic import CreateView, UpdateView, DeleteView
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.contrib.messages.views import SuccessMessageMixin
from django.urls import reverse_lazy
from django_filters.views import FilterView
from .filters import SubjectFilter
from .mode... | StarcoderdataPython |
5186950 | #!/usr/bin/env python
# encoding: utf-8
#
# Copyright SAS Institute
#
# 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 b... | StarcoderdataPython |
12845066 | <reponame>winsonluk/Alizon<filename>aliexp.py<gh_stars>10-100
from aliexpress_api_client import AliExpress
import PIL
from PIL import Image, ImageChops
import urllib2 as urllib
import io
from itertools import izip
from libImgComp import comp_imgs
def comp_images(i1, i2):
maxsize = (500, 500)
i1.resize(maxsi... | StarcoderdataPython |
3295833 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-12 04:38
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.manager
import django.utils.timezone
import model_utils.fields
import phonenumber_field.modelfields
class Migration(migrations.Migration):
... | StarcoderdataPython |
3479875 | """
Placeholder file for satellite navigation algorithms
"""
import numpy as np
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.