id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
98478 | <filename>tools/disasm.py<gh_stars>0
import argparse
import subprocess
import re
FLINE_RE = re.compile(r'\s*/\*\w{4}\*/\s*([^;]*;)\s*/\* 0x(\w{16}) \*/\s*')
SLINE_RE = re.compile(r'\s*/\* 0x(\w{16}) \*/\s*')
FNAME_RE = re.compile(r'\s*Function : ([\w|\(|\)]+)\s*')
BRA_RE = re.compile(r'(.*BRA(?:\.U)? )(0x\w+);')
de... | StarcoderdataPython |
127964 | <reponame>krakowiakpawel9/python_kurs<filename>02_struktury_danych/02_tuple.py
# -*- coding: utf-8 -*-
"""
@author: <EMAIL>
@site: e-smartdata.org
"""
empty_tuple = tuple()
print(empty_tuple)
# %%
amazon = ('Amazon', 'USA', 'Technology', 1)
google = ('Google', 'USA', 'Technology', 2)
# %%
name_google = google[0]
#... | StarcoderdataPython |
3316121 | <reponame>cducrest/eth-tester-rpc<filename>tests/integration/web3/threads.py
"""
A minimal implementation of the various gevent APIs used within this codebase.
"""
import threading
class ThreadWithReturn(threading.Thread):
def __init__(self, target=None, args=None, kwargs=None):
super().__init__(
... | StarcoderdataPython |
38286 | import logging
import os
from figcli.config.style.color import Color
from figcli.io.input import Input
from figcli.svcs.config_manager import ConfigManager
from figcli.config.aws import *
from figcli.config.constants import *
log = logging.getLogger(__name__)
class AWSConfig:
"""
Utility methods for interac... | StarcoderdataPython |
3326436 | <reponame>mahmoudimus/cosmosquest-ng
from glob import glob
from os.path import basename
from os.path import splitext
import setuptools
setuptools.setup(
name='kosmosquest-ng',
version='0.1-beta',
url='https://github.com/mahmoudimus/kosmosquest-ng',
license='Apache License 2.0',
author='mahmoudimu... | StarcoderdataPython |
4825149 | <filename>solutions/513_find_bottom_left_tree_value.py
class Solution:
def findBottomLeftValue(self, root: TreeNode) -> int:
"""BFS.
Running time: O(n) where n is the total number of nodes in the tree.
"""
lvl = [root]
while True:
nlvl = []
for node i... | StarcoderdataPython |
1706455 | from bitrix24_bridge.handlers.base import BaseModelHandler
from bitrix24_bridge.models import ProductBX
class ProductHandler(BaseModelHandler):
model = ProductBX
| StarcoderdataPython |
1694768 | import torch
import torch.nn as nn
from torch import Tensor as Tensor
import torch._C as _C
class BoundedTensor(Tensor):
@staticmethod
# We need to override the __new__ method since Tensor is a C class
def __new__(cls, x, ptb, *args, **kwargs):
if isinstance(x, Tensor):
tensor = super... | StarcoderdataPython |
1758448 | <gh_stars>0
# !/usr/bin/env python3
# Author: C.K
# Email: <EMAIL>
# DateTime:2021-09-19 13:32:45
# Description:
class Solution:
def topKFrequent(self, nums: List[int], k: int) -> List[int]:
bucket = [[] for _ in range(len(nums) + 1)]
Count = Counter(nums).items()
for num, freq in Count:
... | StarcoderdataPython |
3393307 | from vk_api.execute import VkFunction
def test_execute(vk):
func_add = VkFunction('return %(x)s + %(y)s;', args=('x', 'y'))
func_get = VkFunction(
'return API.users.get(%(values)s)[0]["id"];',
args=('values',)
)
assert func_add(vk, 2, 6) == 8
assert func_get(vk, {'user_ids': 'duro... | StarcoderdataPython |
1722429 | <reponame>yasiupl/PSI
#!/bin/python3
import socket
import time
import struct
TCP_IP = '10.200.200.1'
TCP_PORT = 1338
BUFFER_SIZE = 1024
mean = 0
max = 0
min = 100
n = 0
N = 10
print("Measuring TCP roundtrip time to/from {0}".format(str(TCP_IP)))
while n < N:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
... | StarcoderdataPython |
1663380 | """
Project: RadarBook
File: right_circular_cone.py
Created by: <NAME>
One: 11/24/2018
Created with: PyCharm
Copyright (C) 2019 Artech House (<EMAIL>)
This file is part of Introduction to Radar Using Python and MATLAB
and can not be copied and/or distributed without the express permission of Artech House.
"""
from num... | StarcoderdataPython |
92429 | from .xinput import XInputJoystick as Joystick
__all__ = ['Joystick']
| StarcoderdataPython |
120128 | import praw
# Reddit developer credentials
reddit = praw.Reddit(client_id="", client_secret="", username="", password="", user_agent="")
# Instagram password and username
IGusername = ""
IGpassword = ""
| StarcoderdataPython |
1715389 | <filename>FlowNetAPI.py<gh_stars>0
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from torch.autograd import Variable
from tensorboardX import SummaryWriter
from matplotlib import pyplot as plt
from scipy import misc
import argparse, os, sys, subprocess
import setproctitle, colorama
import ... | StarcoderdataPython |
3233607 | """The driver for the opf kpoint selection.
This subroutin requires a POSCAR to be present and a GRIDGEN file to
be present.
The POSCAR should be in the standard VASP format. The GRIDGEN file
should specify the target k-point density.
"""
import os
import numpy as np
from opf_python.universal import find_srBs
if no... | StarcoderdataPython |
48708 | import os, queue
from tablet import Tablet
f = open(os.path.join(os.path.dirname(__file__), '../input/18/part1.txt'), 'r')
def main():
instructionStrings = []
line = f.readline()
while line:
instructionStrings.append(line.rstrip())
line = f.readline()
q0 = queue.Queue()
q1 = queue... | StarcoderdataPython |
3373392 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2019-01-24 17:03
from __future__ import unicode_literals
import colorfield.fields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_countries.fields
import filer.fields.image
import parler.model... | StarcoderdataPython |
22780 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import json
import os
import random
import time
import uuid
import pyrax
from pyrax.autoscale import AutoScaleClient
from pyrax.autoscale import AutoScalePolicy
from pyrax.autoscale import AutoScaleWebhook
from pyrax.autoscale import Sca... | StarcoderdataPython |
3358133 | <filename>twitch_irc.py
from twisted.internet import protocol, reactor
from collections import defaultdict
import bot
import time
import logging
import logging.config
logging.config.fileConfig('logging.conf')
class BotFactory(protocol.ClientFactory):
protocol = bot.TwitchBot
tags = defaultdict(dict)
act... | StarcoderdataPython |
4829220 | <filename>simprod-scripts/resources/scripts/nwandkowsky/detector_baseline/detector.py
#!/bin/sh /cvmfs/icecube.opensciencegrid.org/py2-v2/icetray-start
#METAPROJECT: /data/user/nwandkowsky/tarballs/simulation.V05-01-02/build/simulation.V05-01-02
# import required icecube-related stuff
from icecube import icetray, data... | StarcoderdataPython |
3279587 | params = {
'type': 'MBPO',
'universe': 'gym',
'domain': 'HalfCheetah',
'task': 'v2',
'log_dir': '~/ray_mbpo/',
'exp_name': 'defaults',
'kwargs': {
'epoch_length': 1000,
'train_every_n_steps': 1,
'n_train_repeat': 40,
'eval_render_mode': None,
... | StarcoderdataPython |
1640098 | import os
from os import path as p
from datetime import date as d
# module vars
_basedir = p.dirname(__file__)
_user = os.environ.get('USER', os.environ.get('USERNAME'))
# configurable vars
__APP_NAME__ = 'Proposer'
__YOUR_NAME__ = '<NAME>'
__YOUR_COMPANY__ = 'Nerevu Development'
__YOUR_POSITION__ = 'Managing Directo... | StarcoderdataPython |
4839038 | <gh_stars>0
#!/usr/bin/env python3
import cloudgenix
import argparse
from cloudgenix import jd, jd_detailed
import cloudgenix_settings
import sys
import logging
import os
import datetime
# Global Vars
TIME_BETWEEN_API_UPDATES = 60 # seconds
REFRESH_LOGIN_TOKEN_INTERVAL = 7 # hours
SDK_VERSION = cloudgenix.ve... | StarcoderdataPython |
25160 | <filename>mmdet/models/utils/__init__.py
from .conv_ws import conv_ws_2d, ConvWS2d
from .conv_module import build_conv_layer, ConvModule
from .norm import build_norm_layer
from .scale import Scale
from .weight_init import (
xavier_init,
normal_init,
uniform_init,
kaiming_init,
bias_init_with_prob,
)... | StarcoderdataPython |
12493 | #
#
# Copyright 2009 HPGL Team
#
# This file is part of HPGL (High Perfomance Geostatistics Library).
#
# HPGL 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, version 2 of the License.
#
# HPGL is ... | StarcoderdataPython |
34464 | #!/usr/bin/env python3
# coding=utf-8
import os as os
import sys as sys
import io as io
import traceback as trb
import argparse as argp
import gzip as gz
import operator as op
import functools as fnt
def parse_command_line():
"""
:return:
"""
parser = argp.ArgumentParser()
parser.add_argument('--... | StarcoderdataPython |
17750 | <reponame>omBratteng/mottak
import pytest
from app.domain.models.Metadatafil import Metadatafil, MetadataType
from app.exceptions import InvalidContentType
from app.routers.mappers.metadafil import _get_file_content, metadatafil_mapper, _content_type2metadata_type
def test__content_type2metadata_type__success():
... | StarcoderdataPython |
3254726 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import requests
import sqlite3
import time
import random
import sqlite3
sqlite3.connect('weather.db')
#ID OW_TEMP OW_HUMIDITY OW_PRESSURE OW_COVER
def CREAT_TABLE():
conn = sqlite3.connect('weather.db')
print ("Opened database successfully")
... | StarcoderdataPython |
1626400 | import requests, json
import pandas as pd
from dataiku.connector import Connector
import importio_utils
class ImportIOConnector(Connector):
def __init__(self, config):
"""Make the only API call, which downloads the data"""
Connector.__init__(self, config)
if self.config['api_url'].startswi... | StarcoderdataPython |
1607389 | <filename>map.py
class Map:
width = 0
height = 0
max_lvl = 0
detail = None
def __init__(self):
self.width = 16
self.height = 12
self.max_lvl = 3
self.detail = [[[0 for col in range(self.width)]for row in range(self.height)] for x in range(self.max_lvl)]
self.detail[0] = [[1,1,1,1,1,1,1,1,... | StarcoderdataPython |
1691511 | class Config:
DEBUG = True
| StarcoderdataPython |
1711337 | """
Test wrapper on FMCalcs with friendlier data structures and illustrative
reinsurance functaionality.
"""
import argparse
import itertools
import json
import os
import shutil
import subprocess
from collections import namedtuple
from tabulate import tabulate
import pandas as pd
DEDUCTIBLE_AND_LIMIT_CALCRULE_ID = 1
F... | StarcoderdataPython |
1716510 | from django.apps import AppConfig
class MetricsCollectorConfig(AppConfig):
name = 'metrics_collector'
| StarcoderdataPython |
1648664 | # Copyright 2020, <NAME>, mailto:<EMAIL>
#
# 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 w... | StarcoderdataPython |
3399889 | # Copyright (c) Alibaba Inc. All rights reserved.
import cv2
import numpy as np
import os
from scipy.spatial.distance import cdist
import torch
class Tracker(object):
""" Track the sparse keypoints via their descriptors.
"""
def __init__(self, max_length, matching_method = 'nearest',
cross_check =... | StarcoderdataPython |
4836708 | """Developed by: <NAME> 2017
This Module contains the database class that handles all of the data gathering
and cleaning. It also contains functions that help us work with our data.
"""
import os
import pandas as pd
import numpy as np
import sklearn
from sklearn import preprocessing, model_selection
# from sklearn.mod... | StarcoderdataPython |
1742546 | <filename>tools/reindex/reindex.py
import argparse
import time
import reindex_helpers
from config import Config
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search
#load the args & config
parser = argparse.ArgumentParser("Run the reindex script")
parser.add_argument("--sourceindex", "-s", req... | StarcoderdataPython |
1733279 | <gh_stars>0
def process_media_attribute(attribute, resp, val):
if val:
if val.startswith('jr://'):
pass
elif val.startswith('/file/'):
val = 'jr:/' + val
elif val.startswith('file/'):
val = 'jr://' + val
elif val.startswith('/'):
val = ... | StarcoderdataPython |
68426 | import pytest
from reversion.models import Version
from reversion.revisions import create_revision
from djmoney.money import Money
from .testapp.models import RevisionedModel
@pytest.mark.django_db
def test_that_can_safely_restore_deleted_object():
amount = Money(100, "GHS")
with create_revision():
... | StarcoderdataPython |
3293062 | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
# GN version: //ui/base:unittests
'target_name': 'ui_base_unittests',
... | StarcoderdataPython |
3278680 | <filename>tests/test_validation.py<gh_stars>0
def test_get_recommendation(client, auth):
auth.login()
registration = {"username": "Niklas35",
"password": "<PASSWORD>",
"email": "<EMAIL>"}
rv1 = client.post('/register', json=registration)
assert rv1.data == b'"Suc... | StarcoderdataPython |
3322637 |
# coding: utf-8
# In[29]:
get_ipython().magic('matplotlib inline')
# In[30]:
import os
home_folder = os.path.expanduser("~")
print(home_folder)
# In[31]:
# Change this to the location of your dataset
#data_folder = os.path.join(home_folder, "Data", "Ionosphere")
#data_filename = os.path.join(data_folder, "i... | StarcoderdataPython |
4825863 | <gh_stars>0
# encoding: utf-8
import mimetypes
import re
from django.core.urlresolvers import reverse
def order_name(name):
"""order_name -- Limit a text to 20 chars length, if necessary strips the
middle of the text and substitute it for an ellipsis.
name -- text to be limited.
"""
name = re.su... | StarcoderdataPython |
1681444 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from epimargin.estimators import analytical_MPVS
from epimargin.etl.commons import download_data
from epimargin.etl.covid19india import data_path, get_time_series, load_all_data
from epimargin.model import Model, ModelUnit
from epimargin.plots impo... | StarcoderdataPython |
3321096 | import math
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image, ImageFilter
from skimage import io, measure
from scipy.cluster.vq import kmeans
# can identify up to 255 objects
def mark_objects(image: Image.Image):
new_image = image.copy()
current = 0
free_labels = []
pixels = ... | StarcoderdataPython |
4815186 | import numpy as np
import tensorflow as tf
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
num_puntos = 2000
conjunto_puntos = []
for i in range(num_puntos):
if np.random.random() > 0.5:
x, y = np.random.normal(0.0, 0.9), np.random.normal(0.0, 0.9)
conjunto_puntos.append([x... | StarcoderdataPython |
1792556 | #!/usr/bin/env python3
from elm327 import ELM327, PROTOCOLS
from optparse import OptionParser
class OptParser( OptionParser ):
def format_epilog( self, formatter ):
return '\n{}\n'.format( '\n'.join( [formatter._format_text( x ) for x in self.epilog.split( '\n' )] ) )
# define your own ignore message b... | StarcoderdataPython |
1682385 | <filename>nrgpy/nsd_functions.py<gh_stars>10-100
from datetime import date
from nrgpy.utilities import check_platform
import traceback
if check_platform() == 'win32':
try:
import pyodbc
except:
print("pyodbc required for nrg functions")
import pandas as pd
class nsd(object):
"""class f... | StarcoderdataPython |
132318 | <reponame>hsiang-ever/django_blog
from urllib.request import urlopen, Request
import json
def getPostList():
# url = 'http://0.0.0.0:5000/posts/'
url = 'https://shorten-url-1491815099304.appspot.com/posts/'
headers = {'Content-Type': 'application/json'}
req = Request(url=url, headers=headers)
res = urlopen(req)
... | StarcoderdataPython |
3394107 | <reponame>Mephisto405/WCMC-Public<gh_stars>10-100
import os
import sys
import time
import argparse
import matplotlib.pyplot as plt
from collections import OrderedDict
import torch
import numpy as np
import torch.nn as nn
from torch.utils.data import DataLoader
import train_kpcn
import train_sbmc
import train_lbmc
f... | StarcoderdataPython |
3384192 | from game.environment import GameEnvironment
from game.handlers import Handlers
from game.handlers.network import NetworkHandler
from game.handlers.serialize import SerializeHandler
class LeaderBoardHandler(Handlers):
def __init__(self):
Handlers().__init__()
self.__game_env = GameEnvironment()
... | StarcoderdataPython |
3323943 | <filename>utils/disambiguate.py
import asyncio
import functools
import random
import re
import weakref
from itertools import starmap
import discord
from discord.ext import commands
from .examples import get_example
from .colors import random_color
_ID_REGEX = re.compile(r'([0-9]{15,21})$')
async def disambiguate(c... | StarcoderdataPython |
30659 | <reponame>davidfotsa/Numerical_Methods_With_Python
# -*- coding: utf-8 -*-
def a(i,x,X,Y):
rep=1
for j in range(min(len(X),len(Y))):
if (i!=j):
rep*=(x-X[j])/(X[i]-X[j])
return (rep)
def P(x,X,Y):
rep=0
for i in range(min(len(X),len(Y))):
rep+=a(i,x,X,Y)*Y[i]
return (rep)
X=[-2,0,1,2]
... | StarcoderdataPython |
3379016 | import dicom
from numpy import *
import SimpleITK as sitk
import os
def read_ct_scan(path, verbose=False):
# type: (object) -> object
# Read the slices from the dicom file
slices = []
if os.path.isfile(path):
try:
return sitk.ReadImage(path)
except:
if verbose:
... | StarcoderdataPython |
1607274 | <reponame>nanjekyejoannah/pypy
def test_process_prompt():
from pyrepl.reader import Reader
r = Reader(None)
assert r.process_prompt("hi!") == ("hi!", 3)
assert r.process_prompt("h\x01i\x02!") == ("hi!", 2)
assert r.process_prompt("hi\033[11m!") == ("hi\033[11m!", 3)
assert r.process_prompt("h\x... | StarcoderdataPython |
3398006 | <gh_stars>1-10
import tensorflow as tf
import numpy as np
#import re
import os
model_dir = './product-recognition/inception'
image = './product-recognition/pic/靴子/238320.png'
#将类别ID转换为人类易读的标签
class NodeLookup(object):
def __init__(self, label_lookup_path=None, uid_lookup_path=None):
if not label_lookup_pa... | StarcoderdataPython |
128882 | <reponame>DouglasUrner/markdown-pp
# Copyright 2015 <NAME>
# Licensed under the MIT license
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import re
from os import path
from MarkdownPP.Module import Module
from MarkdownPP.Transform import Transfor... | StarcoderdataPython |
1796351 | <filename>laetoli/ontologies.py
# Laetoli Areas Vocabulary
laetoli = 'Laetoli'
kakesio = 'Kakesio'
esere = 'Esere'
LAETOLI_AREAS = (
(laetoli, 'Laetoli'),
(kakesio, 'Kakesio'),
(esere, 'Esere-Noiti'),
)
# Laetoli Stratographic Units
ngaloba = 'Ngaloba Beds'
qngaloba = '?Ngaloba Beds'
olpiro = 'Olpiro Beds... | StarcoderdataPython |
27084 | <gh_stars>0
# Get instance
import instaloader
import json
L = instaloader.Instaloader(max_connection_attempts=0)
# Login or load session
username = ''
password = ''
L.login(username, password) # (login)
# Obtain profile metadata
instagram_target = ''
profile = instaloader.Profile.from_username(L.... | StarcoderdataPython |
35409 | from .nodes import Host, HostSchema, Session, SessionSchema, Project, SSHKey
| StarcoderdataPython |
4829034 | <filename>backend/project-director/authentication/settings.py<gh_stars>0
TOKEN_LENGTH = 10
REFRESH_TOKEN = '<PASSWORD>'
ACCESS_TOKEN = 'access-token' | StarcoderdataPython |
27611 | <gh_stars>1-10
import os
import socket
from typing import Any, Dict, Optional
import hummingbot.connector.derivative.binance_perpetual.constants as CONSTANTS
from hummingbot.client.config.config_var import ConfigVar
from hummingbot.client.config.config_methods import using_exchange
from hummingbot.core.utils.tracking... | StarcoderdataPython |
1650466 | <reponame>Khan/pyobjc-framework-Cocoa
from MyBaseGradientView import *
class MyBezierGradientView (MyBaseGradientView):
def init(self):
self = super(MyBaseGradientView, self).init()
if self is None:
return None
self.myOffsetPt = NSMakePoint(0.0, 0.0)
return self
de... | StarcoderdataPython |
1653340 | #!/usr/bin/env python3
import sys
sys.exit("[ - ] Sedang perbaikan, mohon tunggu update")
| StarcoderdataPython |
4836389 | <reponame>warsaw/pkg-gunicorn
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import t
import functools
import os
import sys
from gunicorn import config
from gunicorn.app.base import Application
from gunicorn.workers.sync import SyncWorke... | StarcoderdataPython |
1657316 | import collections
import io
import json
import logging
import string
import sys
from lxml import etree
logger = logging.getLogger("righter")
class StateController:
def __init__(self):
self.writing = {}
self.change = {}
self.inside_writing = False
self.inside_change = False
... | StarcoderdataPython |
3230285 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 16 02:05:23 2022
@author: Sagi
"""
'''
Sample choice node text:
;-BLOCK-------------------------------------------------------------------------
*f20 # Label
gosub *regard_update
!sd
if %sceneskip==1 && %1020==1 skip 4
gosub *s20
mov %1020,1
skip 9
`You have already vie... | StarcoderdataPython |
3305538 | import unittest
from more_itertools import (
one,
)
from azul import (
config,
)
from azul.es import (
ESClientFactory,
)
from azul.indexer import (
BundleFQID,
)
from azul.indexer.document import (
AggregateCoordinates,
CataloguedEntityReference,
ContributionCoordinates,
)
from azul.loggi... | StarcoderdataPython |
4825826 | from flask_login import current_user, login_user, logout_user, login_required
from flask import render_template, redirect, url_for, flash, g, json
from app.models import Inventory, Event, User, Description
from app.forms import LoginForm
from app.auth import login_check
from app import app, login, db
from json2ht... | StarcoderdataPython |
3266472 | <reponame>rkwojdan/flair35
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import shutil
from flair.data import Dictionary
from flair.trainers.language_model_trainer import TextCorpus
def test_train_resume_language_m... | StarcoderdataPython |
1707600 | from django.conf.urls import url
from django.urls import include
from rest_framework_extensions.routers import (
ExtendedDefaultRouter as DefaultRouter
)
from .views import AuthorViewSet
router = DefaultRouter()
authors_router = router.register(
r'authors', AuthorViewSet, 'authors'
)
urlpatterns = [
url... | StarcoderdataPython |
1720412 | <reponame>thecodeboy/tink
# 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, soft... | StarcoderdataPython |
195961 | <gh_stars>1-10
#!/usr/bin/env python
# ===--- generate_harness.py ----------------------------------------------===//
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exc... | StarcoderdataPython |
3230531 | # coding=utf-8
import flask
from flask import request,jsonify
import werkzeug
import os
import tensorflow as tf
import getConfig
import numpy as np
import pickle
import requests
import json
from PIL import Image
gConfig = {}
gConfig = getConfig.get_config(config_file='config.ini')
app = flask.Flask("imgClassifierWeb")... | StarcoderdataPython |
3286639 | <reponame>whitfin/spack<filename>var/spack/repos/builtin/packages/r-rsamtools/package.py
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RRsam... | StarcoderdataPython |
3290628 | #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
# Simulation class for threading Kernel objects
#
# macrospin Python package
# Authors: <NAME>
# Copyright: 2014-2015 Cornell University
#
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
import numpy as np
... | StarcoderdataPython |
3256177 | <reponame>mmwest55/FinalProjectCS499
# <NAME>
# 11/1/2020
# User Management System
# import additional files
from login import Login
from customer import Customer
import pandas as pd
# import databases, and database connections
import sqlite3
conn = sqlite3.connect("user_management.db")
cursor = conn.cursor()
# Welc... | StarcoderdataPython |
62729 | <gh_stars>0
"""
Complete game implementations/engines.
"""
| StarcoderdataPython |
3279403 | <filename>similar_said/get_word_similar_said.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''=================================================
@IDE :PyCharm
@Author :LuckyHuibo
@Date :2019/8/28 13:15
@Desc :
1、利用word2vec(模型是预训练好的)跟广度优先搜索算法获取跟“说”有关的词,保存到../data/words.txt
2、加载数据进行查看
===========================... | StarcoderdataPython |
3234103 | <filename>tests/optimizers/test_local_best.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Import modules
import pytest
import numpy as np
# Import from pyswarms
from pyswarms.single import LocalBestPSO
from pyswarms.utils.functions.single_obj import sphere
from .abc_test_optimizer import ABCTestOptimizer
class... | StarcoderdataPython |
50558 | <reponame>bdastur/notes<filename>aws/scripts/sqstest.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
import boto3
import botocore
class SQS(unittest.TestCase):
def setUp(self):
env = os.environ.get('PROFILE_NAME', 'default')
if env == "default":
print "Using... | StarcoderdataPython |
3331435 | <filename>django/gunicorn.conf.py
"""gunicorn WSGI server configuration."""
from multiprocessing import cpu_count
from os import environ
def max_workers():
return (2 * cpu_count()) + 1
bind = "0.0.0.0:" + environ.get("PORT", "8000")
max_requests = 1000
max_requests_jitter = 30
worker_class = "gevent"
workers = ... | StarcoderdataPython |
3392325 | <filename>pyclient/pydeephaven/proto/table_pb2_grpc.py
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from pydeephaven.proto import table_pb2 as deephaven_dot_proto_dot_table__pb2
from pydeephaven.proto impor... | StarcoderdataPython |
60071 | <reponame>marvinthepa/vcs_query<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf8 -*-
# TODO
# documentation
# http://www.ietf.org/rfc/rfc2426.txt
import vobject, sys, os, re
from getopt import gnu_getopt
try:
import cPickle as pickle
except:
import pickle
import logging
vobject_logger = logging.getLogger... | StarcoderdataPython |
1671571 | #! /usr/bin/env python3
# Example wiring (LT-8900 on board to Raspberry Pi):
#
# LT-8900
# _--------------------------------------------------------_
# | VCC | RST | MISO | MOSI | SCK | CS | GND |
# |-------+-------+----- -+-------+-------+-------+--------|
# | 3.3v | Reset | SPI ... | StarcoderdataPython |
1787156 | <reponame>odeumgg/warhound
class OneIndexedList(list):
"""
This class exists to hold data which is one-indexed.
It pads the zero index with None, and will behave incorrectly if this
pad is ever removed. Suggested use is append-only.
When iterating over this list, the first item will be discarded... | StarcoderdataPython |
180297 | <filename>Chapter05/code/chapter5_05/contacts_view.py
import tkinter as tk
from contact import Contact
class ContactList(tk.Frame):
def __init__(self, master, **kwargs):
super().__init__(master)
self.lb = tk.Listbox(self, **kwargs)
scroll = tk.Scrollbar(self, command=self.lb.yview)
... | StarcoderdataPython |
17051 | <filename>async-functions.py<gh_stars>0
'''
<NAME>
Credit to Sentdex (https://pythonprogramming.net/)
'''
import asyncio
async def find_divisibles(inrange, div_by):
# Define division function with async functionality
print("finding nums in range {} divisible by {}".format(inrange, div_by))
located = []
... | StarcoderdataPython |
17047 | <reponame>mrocklin/pygdf<gh_stars>1-10
from setuptools import setup
import versioneer
packages = ['pygdf',
'pygdf.tests',
]
install_requires = [
'numba',
]
setup(name='pygdf',
description="GPU Dataframe",
version=versioneer.get_version(),
classifiers=[
# "Devel... | StarcoderdataPython |
1706393 | # Copyright 2016 A10 Networks
#
# 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 agree... | StarcoderdataPython |
1658099 | import pytest
from django.utils import timezone
from expenses.models import Expenses
from factories.house import HouseFactory
from house.models import House, Country, City
AMOUNT = '100'
DATE = timezone.now()
CATEGORY = 'Clothing'
HOUSE_NAME = "House 1"
HOUSE_NAME_1 = "House one"
HOUSE_NAME_2 = "House two"
HOUSE_PUBL... | StarcoderdataPython |
3296650 | <reponame>CLARIN-PL/personalized-nlp<filename>personalized_nlp/datasets/emotions/emotions.py
from typing import List
import pandas as pd
import os
from personalized_nlp.settings import STORAGE_DIR
from personalized_nlp.utils.data_splitting import split_texts
from personalized_nlp.datasets.datamodule_base import BaseD... | StarcoderdataPython |
3357939 | import os
import logging
import ferris
log = logging.getLogger(__name__)
_log = logging.getLogger()
_log.addHandler(logging.StreamHandler())
_log.setLevel(logging.DEBUG)
class Client(ferris.Client):
async def on_ready(self):
log.info("Starting test.")
g = await self.create_guil... | StarcoderdataPython |
3234445 | from django.db import models
from django.urls import reverse
from django.contrib.auth.models import User
import uuid
class TeachingMethod(models.Model):
id = models.UUIDField(
primary_key=True,
default=uuid.uuid4,
help_text='Уникальное ID для данного метода'
)
title = models.CharF... | StarcoderdataPython |
1756966 | """Training routines for LSTM model."""
import os
from collections import OrderedDict
import numpy as np
from tqdm import tqdm
import torch
from torch.autograd import Variable
import torch.optim as optim
import torch.multiprocessing as mp
from torch.nn.utils import clip_grad_norm
import utils, criterion
class Trainer... | StarcoderdataPython |
1675166 | <filename>python/openassetio/hostAPI/terminology.py<gh_stars>10-100
#
# Copyright 2013-2021 The Foundry Visionmongers Ltd
#
# 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
#
# htt... | StarcoderdataPython |
1763426 | # 2020.07.06
# Problem Statement:
# https://leetcode.com/problems/add-two-numbers/
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:... | StarcoderdataPython |
1611742 | <reponame>MrBurtyyy/yoti-python-sdk
from yoti_python_sdk.sandbox.attribute import SandboxAttribute
from yoti_python_sdk import config
import base64
class YotiTokenResponse(object):
def __init__(self, token):
self.__token = token
@property
def token(self):
"""
The token to be used ... | StarcoderdataPython |
3218682 | import argparse
import glob
import multiprocessing
import re
from functools import partial
from pathlib import Path
import librosa
import numpy
from become_yukarin import SuperResolution
from become_yukarin.config.sr_config import create_from_json as create_config
from become_yukarin.dataset.dataset import AcousticFe... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.