id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
1647643
import hypothesis.strategies as st import torch from hypothesis import assume from hypothesis import given from myrtlespeech.builders.fully_connected import build from myrtlespeech.model.fully_connected import FullyConnected from myrtlespeech.protos import fully_connected_pb2 from tests.builders.test_activation import...
StarcoderdataPython
1797310
<reponame>rkisdp/rkisdp.django.backend<filename>contact/apis/social_links.py<gh_stars>0 # -*- coding: utf-8 -*- # python imports from __future__ import unicode_literals # lib imports from rest_framework.generics import ListAPIView # project imports from contact.models import SocialLink from contact.serializers.social...
StarcoderdataPython
1748958
from django.apps import AppConfig class TwitterCloneAppConfig(AppConfig): name = 'twitter_clone_app'
StarcoderdataPython
1732716
<reponame>ankile/budbua-classifieds # Generated by Django 2.1.7 on 2019-02-26 12:20 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('auctions', '0012_auto_20190226_1146'), ('auctions', '0012_auto_20190219_1012'), ('auctions', '0012_auto_20190222_...
StarcoderdataPython
60566
import sys import logging from face_client import face_client from face_client.api_proxy import FaceApiProxy from face_client.camera_controller import CameraController from face_client.image_displayer import ImageDisplayer def main(argv): client = face_client.FaceClient(CameraController(), ImageDisplayer(), Face...
StarcoderdataPython
1665474
<filename>rrd/store.py<gh_stars>1-10 #-*- coding:utf-8 -*- import MySQLdb from rrd import config def connect_db(host, port, user, password, db): try: conn = MySQLdb.connect( host=host, port=port, user=user, passwd=password, db=db, use_...
StarcoderdataPython
123874
<filename>closedSet/closed_set.py #!/usr/bin/env python2 # -*- coding: utf-8 -*- """ """ # reset all variable # like clear all in matlab from IPython import get_ipython get_ipython().magic('reset -sf') __author__ = '<NAME>' import numpy as np import os, glob from scipy import signal # detect ...
StarcoderdataPython
1712122
<reponame>raliouat/purview-serverless from azure.core.exceptions import AzureError, ClientAuthenticationError, ResourceNotFoundError, ResourceExistsError from utils.purview_client import get_purview_client import logging import json import azure.functions as func def get_all_scans_by_ds(client, ds_name:str):...
StarcoderdataPython
121393
import serial import MySQLdb device = '/dev/ttyACM0' #ser = serial.Serial('/dev/ttyACM1', 9600) arduino = serial.Serial(device, 9600) data = arduino.readline() print('Encoded Serial Databyte'+ data) temp = data.decode('UTF-8') print(temp) #Make DB connection dbConn = MySQLdb.connect("localhost", "root", "password...
StarcoderdataPython
1688116
<gh_stars>1-10 import datetime from pathlib import Path from .context import browser_history from .utils import become_linux, become_windows, change_homedir # pylint: disable=unused-import # pylint: disable=redefined-outer-name,unused-argument def test_firefox_linux(become_linux, change_homedir): """Test history...
StarcoderdataPython
74509
from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import # Standard imports from future import standard_library standard_library.install_aliases() from builtins import * import sys import datetime import uuid import logging impo...
StarcoderdataPython
16362
"""Additional GitHub specific tools. """
StarcoderdataPython
8436
<reponame>kubapi/hater # Generated by Django 3.2.3 on 2021-06-13 19:58 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('feed', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='player', name='finished_...
StarcoderdataPython
77087
from abc import ABCMeta, abstractmethod from collections import defaultdict from counter_backport import Counter from elfstatsd import utils, settings class Storage(): """Abstract class used as a parent for statistics storages""" __metaclass__ = ABCMeta def __init__(self, name): self.name = name...
StarcoderdataPython
64447
from PWMparser import * t = open("/home/hsuj/Downloads/All_PWMs/SCI09/Gcm1_pwm_primary.txt", 'rU') index, matrix, size = uniProbe_parse(t) print(matrix) print(size)
StarcoderdataPython
3360978
<reponame>levilucio/SyVOLT from core.himesis import Himesis import cPickle as pickle from uuid import UUID class HSM2SM_partial(Himesis): def __init__(self): """ Creates the himesis graph representing the AToM3 model HSM2SM_partial. """ # Flag this instance as compiled now ...
StarcoderdataPython
1759637
import matplotlib matplotlib.use("Agg") import matplotlib.pylab as plt import os import librosa import numpy as np import torch from torch.utils.data import DataLoader import sys if os.path.isdir(os.path.join(os.getcwd(),'pre-train')): sys.path.append('pre-train') from reader import TextMelIDLoader, TextMelIDCol...
StarcoderdataPython
120161
#!/usr/bin/env python import sys import os sys.path.append(os.path.join(os.path.abspath('.'), 'lib')) import re from flask import request import telegram from actualapp import app from bot_helper import bot, TOKEN, sendMsg, editMsg, editMsgReplyMarkup, makeInlineKeyboard from io_helper import serialise, deserialise...
StarcoderdataPython
152363
<gh_stars>0 # Copyright (c) 2015 Midokura SARL, All Rights Reserved. # # @author: <NAME> <<EMAIL>>, Midokura
StarcoderdataPython
1694448
import json from requests import HTTPError class MailjetError(Exception): def __init__(self, *args, **kwargs): self.email_message = kwargs.pop('email_message', None) self.payload = kwargs.pop('payload', None) if isinstance(self, HTTPError): self.response = kwargs.get('respon...
StarcoderdataPython
3381883
<reponame>huq-industries/carto-spatial-extension<filename>modules/transformations/redshift/lib/center_lib/helper.py # Copyright (c) 2020, <NAME> (Python3 implementation) # Copyright (c) 2021, CARTO from __future__ import division from math import sqrt def euclidean_distance(p1, p2): return sqrt((p2[0] - p1[0]) *...
StarcoderdataPython
3298119
# ------------------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. # -------------------------------------------------------------------...
StarcoderdataPython
1758577
import sys import pysam import subprocess from re import sub import os from itertools import izip bamsortfn = sys.argv[1] bamrepairedfn = sub('.sorted.bam$', ".repaired.bam", bamsortfn) bamrepairedsortfn = sub('.sorted.bam$', ".repaired.sorted.bam", bamsortfn) if(os.path.isfile(bamsortfn)): inbam = pysam.Samfi...
StarcoderdataPython
1613765
<filename>src/reader.py import collections import numpy as np import re class TextProcessor(object): @staticmethod def from_file(input_file): with open(input_file, 'r', encoding = 'utf8') as fh: text = fh.read() return TextProcessor(text) def __init__(self, text): # se...
StarcoderdataPython
1748191
<filename>greenonbrown.py #!/home/pi/.virtualenvs/owl/bin/python3 from algorithms import exg, exg_standardised, exg_standardised_hue, hsv, exgr, gndvi from button_inputs import Selector, Recorder from image_sampler import image_sample from imutils.video import VideoStream, FileVideoStream, FPS from relay_control import...
StarcoderdataPython
4822543
<reponame>JaumVitor/HOMEWORK-PYTHON n1 = float(input('DIGITE O PRIMEIRO VALOR: ')) n2 = float(input('DIGITE O SEGUNDO VALOR : ')) n3 = float(input('DIGITE O TERCEIRO VALOR: ')) if (n2 < n1 > n3): print('VALOR',n1,'É O MAIOR VALOR') elif (n1 < n2 > n3): print('VALOR',n2,'É O MAIOR VALOR') elif (n1 < n3 > n2 ): ...
StarcoderdataPython
3225125
<reponame>deephdc/deep-oc-client # -*- coding: utf-8 -*- # Copyright 2019 Spanish National Research Council (CSIC) # # 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....
StarcoderdataPython
50382
""" Train Fashion MNIST CNN Code borrowed from http://danialk.github.io/blog/2017/09/29/range-of- convolutional-neural-networks-on-fashion-mnist-dataset/ """ # Specify visible cuda device import os os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = "7" import numpy as np from keras.pre...
StarcoderdataPython
1689550
<reponame>vikrantsingh-vs53/Final-Senior-Year-Project- # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django.utils.timezone import django.contrib.sites.managers import sorl.thumbnail.fields from django.conf import settings import newsletter.utils import ...
StarcoderdataPython
3344222
#!/usr/bin/env python # license removed for brevity import rospy from std_msgs.msg import Float64 def servo_cmd(servo_val, flag): pub = rospy.Publisher('/simple_model/base_to_second_joint_position_controller/command', Float64, queue_size=40) pub2 = rospy.Publisher('/simple_model/base_to_first_joint_position_c...
StarcoderdataPython
124556
from typing import List ''' Easy ''' class Solution_1: def minArray(self, numbers: List[int]) -> int: for i in range(1, len(numbers)): if numbers[i - 1] > numbers[i]: return numbers[i] return numbers[0] # 二分查找 # 作者:LeetCode-Solution # 链接:https://leetcode-c...
StarcoderdataPython
4828593
<gh_stars>0 import docker import os import copy # from threading import Thread import concurrent.futures class DockerContainer: def __init__(self): self.client = docker.from_env() self.containers = [] self.available_containers = [] def create_containers(self,no_containers): try: # Check if run-code-image...
StarcoderdataPython
25602
<filename>tests/test_day5.py from aoc_2020.day5 import part1, get_pos, part2 data = """BFFFBBFRRR FFFBBBFRRR BBFFBBFRLL """ def test_get_pos(): assert get_pos("FBFBBFFRLR") == (44, 5) def test_part1(): assert part1(data) == 820 def test_part2(): assert part2(data) is None
StarcoderdataPython
3341722
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri May 7 21:28:46 2021 @author: marco """ import sim #import sys import numpy as np #import math #import matplotlib.pyplot as plt from inference_by_python import inference #import time #import cv2 '''******IMPOTRANT****** simRemoteApi.start(19999) -- i...
StarcoderdataPython
3224402
<filename>DB/Entities/Process.py # Copyright © 2017 <NAME> <<EMAIL>> # Copyright © 2017 <NAME> <<EMAIL>> from sqlalchemy import Column from sqlalchemy import Integer from sqlalchemy import String from sqlalchemy import TIMESTAMP from DB.Entities import Base class Process(Base): """ Object model for a submis...
StarcoderdataPython
1733496
""" FRODO: a FRamework for Open/Distributed Optimization Copyright (C) 2008-2013 <NAME>, <NAME> & <NAME> FRODO is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your ...
StarcoderdataPython
3333733
<reponame>andreycizov/python-xrpc import logging import multiprocessing from subprocess import Popen import shutil import signal import subprocess import sys import unittest from contextlib import ExitStack from datetime import timedelta, datetime from itertools import count from os import environ from tempfile import...
StarcoderdataPython
1681583
<reponame>newlikehalo/pytroch-ctpn-Retina # -*- coding:utf-8 -*- # ''' # Created on 18-12-11 上午10:03 # # @Author: <NAME>(laygin) # ''' import os os.environ['CUDA_VISIBLE_DEVICES'] = '' import cv2 import numpy as np import glob import torch import torch.nn.functional as F from ctpn_model import CTPN_Model from ctpn_uti...
StarcoderdataPython
6350
import os import warnings from django.conf import settings CAPTCHA_FONT_PATH = getattr(settings, 'CAPTCHA_FONT_PATH', os.path.normpath(os.path.join(os.path.dirname(__file__), '..', 'fonts/Vera.ttf'))) CAPTCHA_FONT_SIZE = getattr(settings, 'CAPTCHA_FONT_SIZE', 22) CAPTCHA_LETTER_ROTATION = getattr(settings, 'CAPTCHA_L...
StarcoderdataPython
1704412
<gh_stars>0 # ------------------------------------------------------------------------------ # IMPORTS # ------------------------------------------------------------------------------ from sys import version_info from sys import path as syspath from os import path import json _CURRENT...
StarcoderdataPython
1621531
<gh_stars>1-10 # # PySNMP MIB module DLINK-3100-CLI-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DLINK-3100-CLI-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:48:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3...
StarcoderdataPython
3362414
<filename>sdk/python/pulumi_gcp/compute/ha_vpn_gateway.py<gh_stars>100-1000 # coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from ty...
StarcoderdataPython
100880
from django.core.management.base import BaseCommand from mixer.backend.django import mixer from situation_report_app.models import Post from users_app.models import AppUser class Command(BaseCommand): def handle(self, *args, **options): AppUser.objects.filter(is_superuser=False).delete() count ...
StarcoderdataPython
79476
import IPython.lib.demo as ipd # To use, run ipython, then # # In [1]: %run Demos.py # In [2]: d = ImageDemo() # In [3]: d() # In [4]: d() def ImageDemo (): return ipd.ClearIPDemo ( 'BasicTutorial1/Image.py' ) def InputOutputDemo (): return ipd.ClearIPDemo ( 'BasicTutorial1/InputOutput.py' ) def MemoryManag...
StarcoderdataPython
116381
<gh_stars>10-100 # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'IMWindow.ui' # # Created: Mon Oct 09 13:21:20 2006 # by: PyQt4 UI code generator 4.0.1 # # WARNING! All changes made in this file will be lost! import sys from PyQt4 import QtCore, QtGui class Ui_IMWindow(...
StarcoderdataPython
1723233
import random import json from requests import get # Get Random useragent def RandomUSERagent(): fp = open('user_agents.txt', 'r') Content = fp.read() CoList = Content.split('\n') USER_AGENTS_LIST = [] for i in CoList: try: USER_AGENTS_LIST.append(i) except: pass return random.choice(USER_AGENTS...
StarcoderdataPython
1630865
<filename>generated-libraries/python/netapp/service_processor/sp_link_status.py class SpLinkStatus(basestring): """ Possible states for the underlying physical link for a network insterface Possible values: <ul> <li> "up" - Link is connected, <li> "down" - Link is severed, <li>...
StarcoderdataPython
194972
from __future__ import annotations def n31(a: int) -> tuple[list[int], int]: """ Returns the Collatz sequence and its length of any positive integer. >>> n31(4) ([4, 2, 1], 3) """ if not isinstance(a, int): raise TypeError("Must be int, not {}".format(type(a).__name__)) if a < 1: ...
StarcoderdataPython
3200303
''' Created on Apr, 2017 @author: hugo ''' import numpy as np def calc_ranks(x): """Given a list of items, return a list(in ndarray type) of ranks. """ n = len(x) index = list(zip(*sorted(list(enumerate(x)), key=lambda d:d[1], reverse=True))[0]) rank = np.zeros(n) rank[index] = range(1, n + ...
StarcoderdataPython
3394625
<filename>test/test_filequeue.py<gh_stars>0 import json import os import time from six.moves import range import pytest import taskqueue from taskqueue import RegisteredTask, TaskQueue, MockTask, PrintTask, LocalTaskQueue from taskqueue.paths import ExtractedPath, mkpath FILE_QURL = 'fq:///tmp/removeme/taskqueue/fq'...
StarcoderdataPython
1636462
from django.apps import AppConfig class InfraConfig(AppConfig): name = "infra"
StarcoderdataPython
1657995
""" Scene creation functions Listing 60 from <NAME>'s Ray Tracing in a Weekend: https://raytracing.github.io/books/RayTracingInOneWeekend.html <NAME> -- 2020 """ import math from random import random, uniform from pathlib import Path from PIL import Image import colorcet as cc from stl import mesh # numpy-stl f...
StarcoderdataPython
1609564
import hashlib from copy import deepcopy from secrets import token_bytes from ec import (G1FromBytes, G1Generator, G1Infinity, G2FromBytes, G2Generator, G2Infinity, JacobianPoint, default_ec, default_ec_twist, sign_Fq2, twist, untwist, y_for_x) from fields import Fq, Fq2, Fq6, Fq12 from...
StarcoderdataPython
1637071
<filename>groundworks/views.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.views.generic.base import TemplateView from groundworks.response import ( TemplateBadRequestResponse, TemplateForbiddenResponse, TemplateNotFoundResponse, TemplateServerErrorResponse ) class BadRequestV...
StarcoderdataPython
1654919
from django.contrib import admin from .models import HeroInfo, BookInfo class BookInfoAdmin(admin.ModelAdmin): list_display = ['id', 'btitle', 'bpub_date', 'bread', 'bcomment'] class HeroInfoAdmin(admin.ModelAdmin): list_display = ['id', 'hname', 'hgender', 'hcomment', 'hbook_id'] # Register your models h...
StarcoderdataPython
1720270
import numpy as np def normalize(v): norm = np.sqrt((v**2).sum()) if norm == 0: return v return v / norm
StarcoderdataPython
1658192
#!/usr/bin/python3 import os, platform from kivy.app import App from numpy.core.defchararray import count if platform.system() == "Linux" or platform.system() == "Darwin": os.environ["KIVY_VIDEO"] = "ffpyplayer" from pysimbotlib.core import PySimbotApp, Robot, Simbot from kivy.logger import Logger from kivy.conf...
StarcoderdataPython
1637211
<filename>VerticalSlices2.py import numpy as np import matplotlib.pyplot as plt import matplotlib.tri as tri import matplotlib.mlab as mlab from scipy.interpolate import griddata caseName = 'ALM_N_H' # './ABL_N_H/Slices/20000.9038025/U_alongWind_Slice.raw' data = np.genfromtxt('I:/SOWFA Data/' + caseName + '/Slices/20...
StarcoderdataPython
94100
<reponame>kwinter213/TeamDayDream import cv2 import numpy import time cap = cv2.VideoCapture(0) while(True): # Capture frame-by-frame ret, frame = cap.read() #gets the frame #orangeLower=numpy.array([5, 50, 150], dtype="uint8") #uint8 necessary for this kind of thing #orangeUpper=numpy.array([100, 2...
StarcoderdataPython
3295623
__version__ = "0.7.2+snapshot"
StarcoderdataPython
3300496
<gh_stars>0 #---------------------------------------------# # # Mailer will queue up emails, Try to send them # and keep track of if they are sent or not. # Should be executed with a cron job. # #---------------------------------------------# from django.utils.encoding import python_2_unicode_compatible from django.uti...
StarcoderdataPython
1762479
<filename>src/common.py import discord #the client itself client = discord.Client()
StarcoderdataPython
1660281
<reponame>ryotaro/neural_style_transfer from torch import unsqueeze from torch.nn import Parameter from .container import ImageContainer class ImageParameter(ImageContainer): def __init__(self, path, imsize=256): super().__init__(path, imsize) self.parameter = Parameter(self.variable.data) def feed(self,...
StarcoderdataPython
3259666
<gh_stars>1-10 import pandas as pd import os import urllib.request import sys utils_path = os.path.join(os.path.abspath(os.getenv('PROCESSING_DIR')),'utils') if utils_path not in sys.path: sys.path.append(utils_path) import util_files import util_cloud import util_carto from zipfile import ZipFile import logging im...
StarcoderdataPython
3230554
<reponame>jasonadu/Python-2.5 from test import test_support import StringIO # SF bug 480215: softspace confused in nested print f = StringIO.StringIO() class C: def __str__(self): print >> f, 'a' return 'b' print >> f, C(), 'c ', 'd\t', 'e' print >> f, 'f', 'g' # In 2.2 & earlier, this printed ' ...
StarcoderdataPython
13228
<reponame>stinvi/dava.engine import os import shutil import build_utils def get_supported_targets(platform): if platform == 'win32': return ['win32'] elif platform == 'darwin': return ['macos'] elif platform == 'linux': return ['linux'] else: return [] def get_depende...
StarcoderdataPython
1711187
# Generated by Django 4.0.1 on 2022-01-23 21:46 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('utils', '0014_constellation_historical_image'), ] operations = [ migrations.AddField( model_name='objecttype', name=...
StarcoderdataPython
1708108
<gh_stars>1-10 from ujson import loads as load_json from websocket import create_connection from ..base import _wrap from ...base import StreamNone, StreamEnd from ...thread import run def WebSocket(url, *args, **kwargs): return AsyncWebSocket(url, *args, **kwargs) def AsyncWebSocket(url, json=False, wrap=False...
StarcoderdataPython
47750
def action(ctx): return 'move left'
StarcoderdataPython
1750976
import csv import pandas as pd import geopandas as gpd import dash_html_components as html def seismic_reporting_data(occurence): ''' Seismic Reporting Function Collects the additional features of the disaster like 'Tsunami Alerts', 'Danger Alerts' Depends on the occurence type that is being chosen Parameter : `...
StarcoderdataPython
56829
<reponame>sirmammingtonham/droneee import tensorflow as tf # Get the variables def find_trainable_variables(key): with tf.variable_scope(key): return tf.trainable_variables() # Make directory def make_path(f): # exist_ok: if the folder already exist makes no exception error return os.makedirs(f, e...
StarcoderdataPython
1628595
<reponame>fuzzball81/pipenv<filename>tests/integration/test_project.py # -*- coding=utf-8 -*- import pytest import os from pipenv.project import Project from pipenv.utils import temp_environ from pipenv.patched import pipfile @pytest.mark.project @pytest.mark.sources @pytest.mark.environ def test_pipfile_envvar_expan...
StarcoderdataPython
9657
<reponame>prettyirrelevant/zeta-python-sdk class InvalidSideException(Exception): """Invalid side""" class NotSupportedException(Exception): """Not supported by dummy wallet""" class InvalidProductException(Exception): """Invalid product type""" class OutOfBoundsException(Exception): """Attempt to...
StarcoderdataPython
64237
# -*- coding: utf-8 -*- # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt from __future__ import unicode_literals import frappe import unittest test_records = [ dict(doctype='Item', item_code='Food Item 1', item_group='Products', is_stock_item=0), dict(doctype='Item', item_cod...
StarcoderdataPython
3302538
from mod2 import * class A: a = 1 def f(x): print x.a def g(y): print y+ o = B() print B.a
StarcoderdataPython
3289626
<reponame>RingoIngo/gluon-ts from pts.dataset.repository.datasets import get_dataset, dataset_recipes from pts.dataset.utils import to_pandas import numpy as np import pandas as pd from pts.dataset import ListDataset import torch from pts.model.simple_feedforward import SimpleFeedForwardEstimator import pickle import j...
StarcoderdataPython
120769
<reponame>kchng/Quantum_machine_learning # Author: <NAME> # (c) 2016 # San Jose State University import numpy as np import random import time import sys class insert_file_info : def __init__(self, full_file_path, filenumber, batch_size = 50, use_random_seed = False, include_validation_data = False, ...
StarcoderdataPython
1732878
<reponame>PressLabs/zinc from .zone import ZoneAdmin from .ip import IPAdmin from .policy import PolicyAdmin from .policy_record import PolicyRecordAdmin
StarcoderdataPython
105381
<filename>djconfig/middleware.py<gh_stars>10-100 # -*- coding: utf-8 -*- from __future__ import unicode_literals from . import conf try: from django.utils.deprecation import MiddlewareMixin except ImportError: # Django < 1.10 MiddlewareMixin = object __all__ = ['DjConfigMiddleware'] class DjConfigMiddle...
StarcoderdataPython
1748013
def structure_features(element): ''' Calculates the structure features for a single atom This is a long description Parameters ---------- Returns ------- Examples -------- ''' if atom == "C": sfeatures[0] = 1 elif atom == "N": sfeatures[1] = 1 ...
StarcoderdataPython
3289338
<reponame>elecro/fuzzinator # Copyright (c) 2016-2018 <NAME>, <NAME>. # # Licensed under the BSD 3-Clause License # <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>. # This file may not be copied, modified, or distributed except # according to those terms. from bson.objectid import ObjectId from datetime ...
StarcoderdataPython
1659578
import os, sys, time from psychopy import visual, core, data, logging from .task_base import Task from ..shared import config STIMULI_DURATION=4 BASELINE_BEGIN=5 BASELINE_END=5 ISI=4 class Speech(Task): DEFAULT_INSTRUCTION = """You will be presented text that you need to read out loud right when you see it.""" ...
StarcoderdataPython
54662
import threading import app.models import app.view import calendar from datetime import date, datetime from app.models import session from app.models.booking import Booking from app.models.returns import Returns def init_database(): app.models.__init__ def init_gui(): app.view.__init__ def generate_invo...
StarcoderdataPython
1648277
# Python - 2.7.6 test.assert_equals( balance_statement('ZNGA 1300 2.66 B, CLH15.NYM 50 56.32 B, OWW 1000 11.623 B, OGG 20 580.1 B'), 'Buy: 29499 Sell: 0' )
StarcoderdataPython
1710710
<reponame>dirble/streamscrobbler-python<gh_stars>10-100 from streamscrobbler import *
StarcoderdataPython
69883
import dash_bootstrap_components as dbc from dash import html from .util import make_subheading form = html.Div( [ make_subheading("Form", "form"), dbc.Form( [ html.Div( [ dbc.Label("Username"), dbc.Inp...
StarcoderdataPython
3379681
<gh_stars>1-10 ''' <NAME> copying from <NAME> and translating from Matlab to Python 2020/5/22 NORMALISE - Normalises image values to 0-1, or to desired mean and variance Usage: n = normalise(im) Offsets and rescales image so that the minimum value is 0 and the maximum value is 1. Resu...
StarcoderdataPython
3213045
<reponame>codered-by-ec-council/Computer-Vision-Face-Recognition-Quick-Starter-in-Python<filename>test_env.py #import the libraries import cv2 import dlib import face_recognition #printing the versions print(cv2.__version__) print(dlib.__version__) print(face_recognition.__version__)
StarcoderdataPython
128974
<filename>Cura/Uranium/UM/Scene/Scene.py # Copyright (c) 2018 <NAME>. # Uranium is released under the terms of the LGPLv3 or higher. import functools # For partial to update files that were changed. import os.path # To watch files for changes. import threading from typing import Callable, List, Optional, Set from P...
StarcoderdataPython
1670844
"""Simple example on how to move the robot.""" import robot_interfaces import robot_fingers def move_up_and_down( frontend: robot_fingers.TriFingerPlatformFrontend, episode_length: int ): """Move up and down multiple times using fixed goal positions. Args: frontend: Frontend of the TriFingerPro ...
StarcoderdataPython
147574
<filename>learning_files/arithmetic.py # Arithmetic # +, -, *, /, %, all work with numbers and variables holding numbers # +=, -=, *=, /=, i.e x += 1 is the same as x = x + 1 x = 1 + 1 # assign 1 + 1 to x y = 0 y += x # add x to y
StarcoderdataPython
1630569
<filename>tacker/db/vm/vm_db.py # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2013, 2014 Intel Corporation. # Copyright 2013, 2014 <NAME> <isaku.yamahata at intel com> # <isaku.yamahata at gmail com> # All Rights Reserved. # # # Licensed under the Apache License, Versi...
StarcoderdataPython
1738682
"""Asynchronous Python client for SolarEnergy devices.""" import aiohttp import asyncio import async_timeout from yarl import URL from xml.parsers.expat import ExpatError from typing import Any from .__version__ import __version__ from .const import ( DEFAULT_PORT, DEFAULT_TIMEOUT, ) from .exceptions import ( ...
StarcoderdataPython
3384196
#!/usr/bin/env python3 import fileinput mem = [int(n.strip()) for n in next(fileinput.input()).split()] size = len(mem) states = set() states.add('.'.join(str(n) for n in mem)) part2 = None steps = 0 while True: i = mem.index(max(mem)) x = mem[i] mem[i] = 0 while x > 0: i += 1 mem[i ...
StarcoderdataPython
1725477
import unittest import utils # O(n^2) time. O(n) space. Space-optimized DP. class Solution: def minimumTotal(self, triangle): """ :type triangle: List[List[int]] :rtype: int """ n = len(triangle) # dp[i][j]: the minimum path sum to reach triangle[i][j] dp =...
StarcoderdataPython
3296006
<filename>cfgrib/bindings.py # # Copyright 2017-2019 European Centre for Medium-Range Weather Forecasts (ECMWF). # # 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/li...
StarcoderdataPython
3338518
import cv2 import numpy as np import re def return_seconds(line): timeValues = line[:line.index("-->")].strip().replace(",",":").split(":") timeValues = list(map(int, timeValues)) hours_to_seconds = timeValues[0] * 3600 minutes_to_seconds = timeValues[1] * 60 seconds = timeValues[2] millisecon...
StarcoderdataPython
1628138
import sympy maxLimit = 10000 for n in range(maxLimit+1): print "true" if sympy.isprime(n) else "false"
StarcoderdataPython
3221608
<gh_stars>1-10 import hashlib import random import requests import sys import time import thread import json import binascii import math import threading from bitarray import * from multiprocessing.pool import ThreadPool from ast import literal_eval from UST import * from user import * from conversation import * from...
StarcoderdataPython
135438
<gh_stars>0 class Solution: def getModifiedArray(self, length: int, updates: List[List[int]]) -> List[int]: arr = [0] * (length + 1) for s, e, i in updates: arr[s] += i arr[e+1] -= i for i in range(1, length): arr[i] += arr[i-1] return arr[:-1]
StarcoderdataPython