id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
3293925 | import requests
import random
from joblib import Parallel, delayed
def register():
r = requests.post('http://52.59.7.147/process', json={
'email': ''.join([random.choice('abcdefghijklmn') for i in range(10)])
})
return r.json()
n = 35
r = Parallel(n_jobs=n)(delayed(register)() for i in range(n))
... | StarcoderdataPython |
1607137 | <reponame>DazEB2/SimplePyScripts<filename>exchange_rates/banki_ru.py<gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
def exchange_rate(currency_id, timestamp=None):
if timestamp is None:
from datetime import datetime
timestamp = int(datetime.today().timest... | StarcoderdataPython |
1604832 | <gh_stars>1-10
import unittest
from Card import Card
from Player import Player
from Shoe import Shoe
from Hand import Hand
class ShoeTester(unittest.TestCase):
def test_gen_cards(self):
shoe = Shoe()
self.assertEqual(len(shoe.cards), 8*52)
self.assertEqual(type(shoe.cards[0]), Card)
... | StarcoderdataPython |
104052 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 23 13:11:49 2020
@author: abdulroqeeb
"""
host = "127.0.0.1"
port = 7497
ticktypes = {
66: "Bid",
67: "Ask",
68: "Last",
69: "Bid Size",
70: "Ask Size",
71: "Last Size",
72: "High",
... | StarcoderdataPython |
1651608 | <filename>colorbrewer/__init__.py
#!/usr/bin/env python
from __future__ import absolute_import, division
__version__ = "0.2.0"
from six.moves import map
"""
__init__: DESCRIPTION
data copyright <NAME>, <NAME>, and The Pennsylvania State University
"""
# Copyright 2009, 2012 <NAME> <<EMAIL>>
from collections import... | StarcoderdataPython |
3368824 | <reponame>chatto-hub-test2/github-permission
from chatto_transform.transforms.transform_base import Transform
pipeline_type_error_msg = """Invalid transform list: Transform {i1}'s output schema does not match Transform {i2}'s input schema.
{i1} output schema: {i1s}
{i2} input schema: {i2s}"""
class PipelineTransformE... | StarcoderdataPython |
3303309 | <gh_stars>1-10
"""Interface for all network clients to follow."""
from __future__ import annotations
from abc import ABC, abstractmethod
from xrpl.models.requests.request import Request
from xrpl.models.response import Response
class Client(ABC):
"""
Interface for all network clients to follow.
:meta p... | StarcoderdataPython |
4803004 | <gh_stars>0
def kmp(t, p):
n = len(t)
m = len(p)
begin = 0
matched = 0
res = []
f = failure_function(p)
while begin <= n - m:
if matched < m and t[begin + matched] == p[matched]:
matched += 1
if matched == m:
res.append(begin)
else:
... | StarcoderdataPython |
3222983 | """ Schema for Auth Models """
# pylint: disable=no-self-argument
import re
from typing import Dict, List, Optional
from pydantic import BaseModel, validator
from app.core.security.password import validate_password
from app.helpers.expressions import VALID_EMAIL
class GroupBase(BaseModel):
""" Base Schema for ... | StarcoderdataPython |
1725810 | <gh_stars>0
from django.apps import AppConfig
class DbcallsConfig(AppConfig):
name = 'DBCalls'
| StarcoderdataPython |
1784609 | <reponame>mccolm-robotics/Claver-AI-Assistant<gh_stars>1-10
import numpy as np
from pyrr import Vector3
class BasicTile:
TILE_SIZE = 11
vertices = [
1.0, 0.0, -1.0,
-1.0, 0.0, 1.0,
1.0, 0.0, 1.0,
-1.0, 0.0, -1.0,
-1.0, 0.0, 1.0,
1.0, 0.0, -1.0
]
def _... | StarcoderdataPython |
129353 | <reponame>Lezval/horizon
#!/usr/bin/env python
"""Generates files for sphinx documentation using a simple Autodoc based
template.
To use, just run as a script:
$ python doc/generate_autodoc_index.py
"""
import os
base_dir = os.path.dirname(os.path.abspath(__file__))
RSTDIR = os.path.join(base_dir, "source", "so... | StarcoderdataPython |
170500 | <gh_stars>1000+
import numpy as np
import openml
classification_tasks = [
232, 236, 241, 245, 253, 254, 256, 258, 260, 262, 267, 271, 273, 275, 279, 288, 336,
340, 2119, 2120, 2121, 2122, 2123, 2125, 2356, 3044, 3047, 3048, 3049, 3053, 3054,
3055, 75089, 75092, 75093, 75098, 75100, 75108, 75109, 75112, 75... | StarcoderdataPython |
3398344 | <filename>simulation/aivika/modeler/__init__.py<gh_stars>0
# Copyright (c) 2017 <NAME> <<EMAIL>>
#
# Licensed under BSD3. See the LICENSE.txt file in the root of this distribution.
from simulation.aivika.modeler.specs import *
from simulation.aivika.modeler.model import *
from simulation.aivika.modeler.expr import *
f... | StarcoderdataPython |
1600599 | # -*- coding: utf-8 -*-
"""Qlik Engine."""
import math
from typing import Any, Dict, List, Union
from luft.vendor.pyqlikengine.engine_app_api import EngineAppApi
from luft.vendor.pyqlikengine.engine_field_api import EngineFieldApi
from luft.vendor.pyqlikengine.engine_generic_object_api import EngineGenericObjectApi
f... | StarcoderdataPython |
186474 | <gh_stars>1-10
import sys
import getopt
import logging
import botocore
import boto3
import time
from packaging import version
from time import sleep
from botocore.exceptions import ClientError
logger = logging.getLogger()
personalize = None
def _get_dataset_group_arn(dataset_group_name):
dsg_arn = None
pagi... | StarcoderdataPython |
1631499 | <gh_stars>1-10
import threading, queue
import time
lock = threading.Lock()
q = queue.Queue()
c = 0
def task(i):
global c
d = 0
for v in range(100000):
d += 1
with lock:
c += d
print("Thread %s" % (i))
if __name__ == "__main__":
tasks = []
for i in range(100):
add... | StarcoderdataPython |
3350401 | <reponame>Thommy257/discopy
# -*- coding: utf-8 -*-
"""
Implements classical-quantum circuits.
Objects are :class:`Ty` generated by two basic types
:code:`bit` and :code:`qubit`.
Arrows are diagrams generated by :class:`QuantumGate`, :class:`ClassicalGate`,
:class:`Discard`, :class:`Measure` and :class:`Encode`.
>>... | StarcoderdataPython |
3218631 | <gh_stars>1-10
#!/usr/bin/env python3
import os, sys
from lxml.etree import Element, ElementTree
class XmlBase (object):
nsmap = {
'ds': 'http://schema.programmfabrik.de/database-schema/0.1',
'es': 'http://schema.programmfabrik.de/easydb-database-schema/0.1',
'em': 'http://schema.programm... | StarcoderdataPython |
10332 | from ..le_apcf_command_pkt import LE_APCF_Command
from struct import pack, unpack
from enum import IntEnum
"""
This pare base on spec <<Android BT HCI Requirement for BLE feature>> v0.52
Advertisement Package Content filter
"""
class APCF_Service_Data(LE_APCF_Command):
def __init__(self):
# TODO generate... | StarcoderdataPython |
1679339 | from pathlib import *
from winreg import *
import subprocess, time, os, re, sys
a, ot, devic, adbcommand = 0, '', [], []
exe = sys.executable
# pathtest = 0
adbpath = 0
adbpathdir = 0
# dname = Path(exe).parent
# dname = Path(dname, 'adb')
# fil = [Path(dname, 'adb.exe'), Path(dname, 'AdbWinApi.dll')]
# try: os.chd... | StarcoderdataPython |
3283571 | <gh_stars>10-100
#!/usr/bin/env python
from __future__ import print_function
from scp import SCPClient
import argparse
import getpass
import inspect
import os
import paramiko
import errno
def parse_args():
parser = argparse.ArgumentParser(
description='Generate pyaci meta from APIC')
parser.add_argu... | StarcoderdataPython |
3275131 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Rewrite exceptions that are thrown and caught locally to jumps.
"""
from flypy.compiler import excmodel
from pykit.analysis import cfa
from pykit.optimizations import local_exceptions
def rewrite_local_exceptions(func, env):
"""
Rewrite exc_throw(exc) -> jump(handler_... | StarcoderdataPython |
1694509 | <gh_stars>10-100
RPL_WELCOME = 1
RPL_YOURHOST = 2
RPL_CREATED = 3
RPL_MYINFO = 4
RPL_BOUNCE = 5
RPL_USERHOST = 302
RPL_ISON = 303
RPL_AWAY = 301
RPL_UNAWAY = 305
RPL_NOWAWAY = 306
RPL_WHOISUSER = 311
RPL_WHOISSERVER = 312
RPL_WHOISOPERATOR = 313
RPL_WHOISSIDLE = 317
RPL_ENDOFWHOIS = 318
RPL_WHOISCHANNELS = 319
RPL_WHOW... | StarcoderdataPython |
15707 | <reponame>jama5262/Politico
import unittest
import json
from app import createApp
from app.api.database.migrations.migrations import migrate
class TestParties(unittest.TestCase):
def setUp(self):
self.app = createApp("testing")
self.client = self.app.test_client()
self.endpoint = "/api/v2/... | StarcoderdataPython |
3223944 | <filename>checkpoint.py
import os
import torch
def save_checkpoint(epoch, step, model, optimizer, save_path):
"""
Save checkpoint pickle file with model weights and other experimental settings
Args:
epoch (Int): Current epoch when model is being saved
step (Int): Mini-batch... | StarcoderdataPython |
3313066 | <reponame>cesarin1981/ProjectBuscaAyuda
from src.projectbuscaayuda.modelo.persona import Persona
from src.projectbuscaayuda.modelo.servicio import Servicio, Categoria_Servicio
from src.projectbuscaayuda.modelo.declarative_base import Session, engine, Base
if __name__ == '__main__':
session = Session()
persona1... | StarcoderdataPython |
1678489 | from django.contrib import admin
from django.contrib.auth.models import Permission
# Register your models here.
from nomenclatoare import models
from guardian.admin import GuardedModelAdmin
from simple_history.admin import SimpleHistoryAdmin
class HistoryChangedFields(object):
history_list_display = ["changed_fie... | StarcoderdataPython |
4822386 | <reponame>vied12/django-moderation<filename>moderation/helpers.py
from __future__ import unicode_literals
from .register import RegistrationError
def automoderate(instance, user):
'''
Auto moderates given model instance on user. Returns moderation status:
0 - Rejected
1 - Approved
'''
try:
... | StarcoderdataPython |
21181 | from OrderedVector import OrderedVector
class Greedy:
def __init__(self, goal):
self.goal = goal
self.found = False
self.travelled_distance = 0
self.previous = None
self.visited_cities = []
def search(self, current):
current.visited = True
self.visited_... | StarcoderdataPython |
1741055 | <reponame>Saurav-Shrivastav/openwisp-users<filename>tests/testapp/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('member_view', views.api_member_view, name='test_api_member_view'),
path('manager_view', views.api_manager_view, name='test_api_manager_view'),
path('owner_view',... | StarcoderdataPython |
3280234 | #!/usr/bin/python
# Classification (U)
"""Program: notmastererror.py
Description: Unit testing of NotMasterError in errors.py.
Usage:
test/unit/errors/notmastererror.py
Arguments:
"""
# Libraries and Global Variables
# Standard
import sys
import os
if sys.version_info < (2, 7):
import ... | StarcoderdataPython |
96721 | from utils import show_messages, get_input
# lets the teachers to add a score for a student of a course
class AddScoreView(object):
def run(self, site, messages=None):
site.clear()
show_messages(messages)
course = get_input('Course Serial: ')
course = site.get_course(serial=course... | StarcoderdataPython |
1658594 | <filename>experimental/k41_contactset/shift.py
#!/usr/bin/python
import sys
f = open(sys.argv[1])
for i in f.readlines():
x,y = map(float,i.split())
x = x + .25
y = y + .25
if x>1:
x = x - 1
if y>1:
y = y - 1
if y>x:
print x,y
else:
print y,x
f.close()
| StarcoderdataPython |
3351961 | <reponame>hritik5102/Awesome-Computer-Vision-Guide
'''
Application of gardients in images
Gradients here itself means partial derivatives.
Gradients are useful in detecting the edges based on color
gradients.
Derivative of a matrix is calculated by an operator called Laplacian.
For derivatives, we have to cal. two... | StarcoderdataPython |
81024 | import json
import numpy as np
from pycocotools import mask as maskUtils
thresh = 0.5
# load retrieval results
results_image_id_all = []
results_query_score_all = []
results_query_cls_all = []
results_query_box_all = []
results_gallery_id_all = []
results_gallery_box_all = []
results_name = ' '
with open(results_na... | StarcoderdataPython |
10586 | #
# Copyright (C) 2018 The Android Open Source Project
#
# 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 la... | StarcoderdataPython |
1689390 | #!/usr/bin/env python
import sys
import os, os.path
import shutil
from ROOT import gROOT,gSystem,gDirectory,RooAbsData,RooRandom,RooWorkspace
## batch mode
sys.argv.insert(1, '-b')
gROOT.Reset()
gROOT.SetBatch(True)
del sys.argv[1]
gSystem.Load("libSusyFitter.so")
gROOT.Reset()
def GenerateFitAndPlot(tl):
from ... | StarcoderdataPython |
93276 | #!/usr/bin/python
import sys
from DG1022 import *
r = RigolDG('/dev/usbtmc0')
c = raw_input("Press any key to query IDN...")
r.meas.write('*IDN?')
c = raw_input("Press any key to read IDN response...")
r.meas.read()
c=raw_input("Press enter to enable Channel 1")
r.enableChan1()
c=raw_input("Press enter to enable Ch... | StarcoderdataPython |
3391657 | <filename>src/eduid_scimapi/db/eventdb.py
from __future__ import annotations
import logging
from dataclasses import asdict, dataclass, field
from datetime import datetime, timedelta
from enum import Enum
from typing import TYPE_CHECKING, Any, Dict, List, Mapping, Optional, Type
from uuid import UUID, uuid4
from bson ... | StarcoderdataPython |
1790266 | """
Outputs a script to convert 2 channel wav files to 1 channel wave files.
"""
import fnmatch
import os
for root, dirnames, filenames in os.walk("orchive"):
for filename in fnmatch.filter(filenames, "*.wav"):
new_filename = filename[:-4] + ".1c.wav"
print("sox {} {} remix 1,2".format(filename, n... | StarcoderdataPython |
3317550 | """
You must put all includes from others libraries before the include of pygin
and put all include of other files after the include of pygin
"""
# Other Libraries includes:
# pygin includes:
from pygin import *
# files includes:
from game.game_objects.controllers.retry_controller import RetryController
class RetryS... | StarcoderdataPython |
91207 | from abc import ABCMeta, abstractmethod
# NOTE: domain service concern with domain and business logic, so call them and has responsibility.
class ObjectRepositoryIF(metaclass=ABCMeta):
# find object source by id from database. This method should return object or None
@abstractmethod
def find_by_id(self, i... | StarcoderdataPython |
1696315 | <filename>securitybot/util.py
__author__ = '<NAME>, <NAME>'
__email__ = '<EMAIL>, <EMAIL>'
import pytz
import secrets
import os
from datetime import datetime, timedelta
from collections import namedtuple
from securitybot.tasker import StatusLevel
def tuple_builder(answer=None, text=None):
tup = namedtuple('Resp... | StarcoderdataPython |
3344165 | <filename>piston/configuration/validators/theme_validator.py
from typing import Union
from piston.configuration.choose_config import choose_config
from piston.configuration.validators.validator_base import Validator
from piston.utilities.constants import Configuration, console, themes
class ThemeValidator(Validator)... | StarcoderdataPython |
3364190 | <reponame>chenkaisun/MMLI1
import argparse
def read_args():
parser = argparse.ArgumentParser()
# pretrained language model
parser.add_argument("--plm", default="bert-base-cased", type=str, metavar='N')
parser.add_argument("--max_seq_len", default=1024, type=int)
# experiment
parse... | StarcoderdataPython |
3347224 | <gh_stars>1-10
#!/usr/bin/env python3
import sys
import os
import signal
import argparse
import logging
import syslog
from gpuctl import __version__
from gpuctl import DRYRUN, GpuCtl, logger
from gpuctl import PciDev, GpuDev, GpuAMD, GpuNV
from gpuctl import EthCtl, scan_miner
def run():
gpu_ctl = None
de... | StarcoderdataPython |
61719 | #
# Copyright (c) 2018 ISP RAS (http://www.ispras.ru)
# Ivannikov Institute for System Programming of the Russian Academy of Sciences
#
# 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
#
# h... | StarcoderdataPython |
3358250 | <filename>nadine-2.2.3/doors/keymaster/tests/test_controller.py
from django.test import SimpleTestCase
from django.utils import timezone
#from doors.hid_control import DoorController
from doors.keymaster.models import Keymaster
from doors.core import Messages, EncryptedConnection, CardHolder, Gatekeeper, TestDoorContr... | StarcoderdataPython |
1601998 | <gh_stars>1-10
import segmentation_models_pytorch as smp
from configs import CFG
from .deeplabv3 import DeepLabV3ResNet18, DeepLabV3ResNet34, DeepLabV3ResNet50, DeepLabV3ResNet101
def build_model(num_channels, num_classes):
if CFG.MODEL.NAME == 'deeplabv3':
return smp.DeepLabV3(encoder_name=CFG.MODEL.BAC... | StarcoderdataPython |
3313826 | <filename>parsons/ngpvan/people.py<gh_stars>1-10
from parsons.utilities import json_format
import logging
logger = logging.getLogger(__name__)
class People(object):
def __init__(self, van_connection):
self.connection = van_connection
def find_person(self, first_name=None, last_name=None, date_of_b... | StarcoderdataPython |
3354435 | <gh_stars>0
# -*- coding: utf-8 -*-
# -*- Mode: Python -*-
# GObject-Introspection - a framework for introspecting GObject libraries
# Copyright (C) 2008-2010 <NAME>
# Copyright (C) 2012-2013 <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Gener... | StarcoderdataPython |
1725323 |
import os
import copy
import datetime
import warnings
from matplotlib import pyplot as plt
import matplotlib as mpl
import seaborn as sns
import pandas as pd
import numpy as np
import math
from datetime import datetime
import random
from sklearn.feature_extraction.text import TfidfVectorizer, CountV... | StarcoderdataPython |
96086 | # library
from redesigned_barnacle.config import load_config, parse_file
from redesigned_barnacle.eth import eth_start
from redesigned_barnacle.sparkline import Sparkline
from redesigned_barnacle.unit import temp_ftoc
from prometheus_express import start_http_server, CollectorRegistry, Counter, Gauge, Router
from bme28... | StarcoderdataPython |
4815494 | from vivarium.utils.datum import Datum
class Protein(Datum):
defaults = {
'id': '',
'sequence': ''}
def __init__(self, config, defaults=defaults):
super(Protein, self).__init__(config, self.defaults)
GFP = Protein({
'id': 'GFP',
'sequence': 'MSKGEELFTGVVPILVELDGDVNGHKFSVSGEGEG... | StarcoderdataPython |
3333729 | def checkupdate():
import requests
from subprocess import Popen, PIPE
with open("babysploit/version", "r") as fwv:
data = fwv.read().replace(" ", "")
cv = requests.get("https://raw.githubusercontent.com/M4cs/BabySploit/master/babysploit/version").text.replace(" ", "")
if data == cv:
... | StarcoderdataPython |
184105 | # openweatherclass Python Program for Raspberry Pi 3
# Author: <NAME>
# Date: August 2, 2021 v1.0.0
# Revision:
# Import class files
import requests
import json
# import pprint
# --------------Class Definitions------------------#
class OpenWeatherAPI(object):
'''
OpenWeatherAPI Class:
Inputs: apikey... | StarcoderdataPython |
10236 | # ██╗░░░░░██╗███╗░░██╗░██████╗░░░░██████╗░██╗░░░░░░█████╗░░█████╗░██╗░░██╗
# ██║░░░░░██║████╗░██║██╔════╝░░░░██╔══██╗██║░░░░░██╔══██╗██╔══██╗██║░██╔╝
# ██║░░░░░██║██╔██╗██║██║░░██╗░░░░██████╦╝██║░░░░░███████║██║░░╚═╝█████═╝░
# ██║░░░░░██║██║╚████║██║░░╚██╗░░░██╔══██╗██║░░░░░██╔══██║██║░░██╗██╔═██╗░
# ███████╗██║██... | StarcoderdataPython |
1703382 | # Important: We are using PIL to read .png files later.
# This was done on purpose to read indexed png files
# in a special way -- only indexes and not map the indexes
# to actual rgb values. This is specific to PASCAL VOC
# dataset data. If you don't want thit type of behaviour
# consider using skimage.io.imread()
fro... | StarcoderdataPython |
65999 | #!/usr/bin/env python3
import sys
import numpy as np
from example import AmiciExample
class ExampleCalvetti(AmiciExample):
def __init__(self):
AmiciExample.__init__( self )
self.numX = 6
self.numP = 0
self.numK = 6
self.modelOptions['theta'] = []
self.modelOption... | StarcoderdataPython |
3266924 | <filename>003/highest_and_lowest_7kyu.py
"""In this little assignment you are given a string of space separated
numbers, and have to return the highest and lowest number."""
def high_and_low(numbers):
"Function to return the smallest and largest element from a list"
numbers = [int(num) for num in numbers.spli... | StarcoderdataPython |
4811105 | <gh_stars>1-10
import numpy as np
class truss:
def __init__(self, x1, x2, y1, y2, E, A,
node1, node2, stress=None, strain=None):
self.x1 = x1
self.x2 = x2
self.y1 = y1
self.y2 = y2
self.E = E
self.A = A
self.l = ((x2-x1)**2+(y2-y1)**2)**(1/2)... | StarcoderdataPython |
1080 | import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gio, Gtk, Gdk
class AddFriendWidget(Gtk.Box):
def __init__(self, main_window, fchat_prv, friend_list):
Gtk.Box.__init__(self, spacing=7, orientation = Gtk.Orientation.VERTICAL)
self.fchat_prv = fchat_prv
self.main_window... | StarcoderdataPython |
88548 | <reponame>vlue-c/Visual-Explanation-Methods-PyTorch
from .simple_grad import SimpleGradient
| StarcoderdataPython |
1771149 | # Copyright 2019 BlueCat Networks (USA) Inc. and its affiliates
#
# 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 appli... | StarcoderdataPython |
4827583 | # hexutil.py
"""Miscellaneous utility routines relating to hex and byte strings"""
# Copyright (c) 2008-2012 <NAME>
# This file is part of pydicom, released under a modified MIT license.
# See the file license.txt included with this distribution, also
# available at http://pydicom.googlecode.com
from binascii im... | StarcoderdataPython |
1784904 | import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
# a = np.linspace(0,10)
# b = np.linspace(0,5)
# plt.figure()
# plt.plot(a,b)
# plt.show()
x_data = np.random.rand(100).astype(np.float32)
y_data = x_data * 0.1 + 0.3
plt.figure()
plt.plot(x_data , y_data, color='red', marker='x',linestyle='... | StarcoderdataPython |
3358030 | <filename>blender_bindings/ui/export_nodes/model_tree_nodes.py
from typing import List
import bpy
from bpy.types import NodeTree, Node, Operator
from . import nodes
class SourceIO_OP_EvaluateNodeTree(Operator):
bl_idname = "sourceio.evaluate_nodetree"
bl_label = "Evaluate tree"
tmp_file: bpy.types.Text
... | StarcoderdataPython |
3354052 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Copyright (c) 2015 <NAME>, <EMAIL>
#
# 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 the rig... | StarcoderdataPython |
3295028 | <filename>tools/binprof.py
#!/usr/bin/env python3
import subprocess
from dataclasses import dataclass
from typing import Optional
from pprint import pprint
from collections import defaultdict
import argparse
# Details of what the bufferent `symbol_type`s mean
# https://sourceware.org/binutils/docs/binutils/nm.html
... | StarcoderdataPython |
1689462 | import re
from markdown.extensions import Extension
from markdown.preprocessors import Preprocessor
class TableIncrementPreprocessor(Preprocessor):
def run(self, lines):
num = 1
new_lines = []
for line in lines:
new_line = line
match = re.match(r"\|\s*(1\.)\s*\|", ... | StarcoderdataPython |
3215463 | # -*- coding: utf-8 -*-
# File: optimizer.py
from contextlib import contextmanager
import tensorflow as tf
from ..tfutils.common import get_tf_version_tuple
from ..compat import tfv1
from ..utils.develop import HIDE_DOC
from .gradproc import FilterNoneGrad, GradientProcessor
__all__ = ['apply_grad_processors', 'Pro... | StarcoderdataPython |
4834792 | #!/usr/bin/env python
from setuptools import setup, find_packages
import provider
setup(
name='edx-django-oauth2-provider',
version=provider.__version__,
description='edX fork of django-oauth2-provider',
long_description=open('README.rst').read(),
author='edX',
author_email='<EMAIL>',
url... | StarcoderdataPython |
78593 | <gh_stars>0
# coding: utf-8
# ##### <h1>BroBeurKids Nikola</h1>
#
# This script deals with creating data for BroBeurKids/wcmckee Nikola site.
#
# The directory to look at is brobeurkidsdotcom/posts
# or folder
#
# wcmckee.com /posts
#
# /github folders are scanned with the input for folders.
# It's basically a s... | StarcoderdataPython |
1729604 | from src.scenario.scenario_generator import ScenarioGenerator
from src.executors.exact.solve_opf import solve
from src.scenario.scenario import Scenario
from src.grid.grid import Grid
import numpy as np
class GridEnv:
def __init__(self,
grid: Grid,
scenario: Scenario,
... | StarcoderdataPython |
1634466 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import numpy as np
def detect_bursts(spikes, dt):
"""Returns the indices of the first spikes of burst-groups, all bursts
and the indices of the previous spike of each burst.
The time that determines the duration of each spike is empirically
predefined.
... | StarcoderdataPython |
1642696 | import re
from .time import times_to_ms
from .formatbase import FormatBase
from .ssaevent import SSAEvent
# thanks to http://otsaloma.io/gaupol/doc/api/aeidon.files.mpl2_source.html
MPL2_FORMAT = re.compile(r"^(?um)\[(-?\d+)\]\[(-?\d+)\](.*)")
class MPL2Format(FormatBase):
"""MPL2 subtitle format implementatio... | StarcoderdataPython |
3231593 | <filename>ex37.py
num = int(input('Digite um numero inteiro: '))
print('''Escolha uma das bases para conversão:'
[1] converter para BINÁRIO
[2] converter para OCTAL
[3] converter para HEXADECIMAL''')
opção = int(input('Sua Opção'))
if opção == 1:
print('{} convertido para Binário é igual {}'.format(num, bin(num)[2:... | StarcoderdataPython |
4391 | <gh_stars>1-10
"""
HTTP MultiServer/MultiClient for the ByteBlower Python API.
All examples are guaranteed to work with Python 2.7 and above
Copyright 2018, Ex<NAME>.
"""
# Needed for python2 / python3 print function compatibility
from __future__ import print_function
# import the ByteBlower module
import byteblowerl... | StarcoderdataPython |
4809230 | <reponame>Columbine21/TFR-Net<filename>trains/missingTask/__init__.py
from trains.missingTask.TFR_NET import TFR_NET
__all__ = ['TFR_NET'] | StarcoderdataPython |
3304220 | <reponame>ouyangjunfei/shopyo<filename>shopyo/modules/settings/models.py
from shopyoapi.init import db
class Settings(db.Model):
__tablename__ = "settings"
setting = db.Column(db.String(100), primary_key=True)
value = db.Column(db.String(100))
| StarcoderdataPython |
196570 | import unittest
import numpy as np
import cal_joint_lps
import data_set_4
import mix_lp
def CalGamma(dataC, dataU, pD, pA, g1, g2, calc_type):
rt_c, rt_u, rt_cu = cal_joint_lps.CalJointLPS(dataC, dataU, g1, g2)
if calc_type == 0:
res = mix_lp.MyGetMixLP2(rt_cu, pA)
return res
lp = rt_... | StarcoderdataPython |
3331360 | # Generated by Django 2.0.8 on 2018-09-19 19:53
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('electionnight', '0005_auto_20180304_1829'),
]
operations = [
migrations.RemoveField(
model_name='apelectionmeta',
name='ball... | StarcoderdataPython |
1783762 | # quick and simple extraction of tor nodes from directory
# with insert into QRadar reference collections.
#
# you'll need the TorCtl python package
# from https://gitweb.torproject.org/pytorctl.git/
# and you'll need to have tor installed on the same
# host where this script runs.
# in the config file (tor_r... | StarcoderdataPython |
81587 |
import renpy
import pygame
import os
import math
import ctypes
import euclid
from OpenGL import GL as gl
FONT_SIZE = 18
FONT = None
def drawText(canvas, text, pos, color, align=-1, background=(128, 128, 128)):
global FONT
if FONT is None:
pygame.font.init()
FONT = pygame.font.Font(None, FONT_... | StarcoderdataPython |
1701799 | """
Adiabatic flame temperature and equilibrium composition for a
fuel/air mixture as a function of equivalence ratio,
including formation of solid carbon.
"""
from Cantera import *
import sys
##############################################################
#
# Edit these parameters to change the initial tem... | StarcoderdataPython |
17220 | <filename>src/psion/oauth2/endpoints/revocation.py
from __future__ import annotations
from typing import Optional
from psion.oauth2.exceptions import InvalidClient, OAuth2Error, UnsupportedTokenType
from psion.oauth2.models import JSONResponse, Request
from .base import BaseEndpoint
class RevocationEndpoint(BaseEn... | StarcoderdataPython |
97713 | import inspect
import logging
import os
import pickle
import cloudpickle
from quake.client.base.task import make_input, new_py_task
from quake.client.job import _set_rank
from quake.common.layout import Layout
from quake.job.config import JobConfiguration
from .glob import get_global_plan, get_inout_obj, set_inout_ob... | StarcoderdataPython |
1733796 | <filename>lib/sldr/hunspell.py
#!/usr/bin/python3
class Aff:
def __init__(self, filename):
self.fname = filename
self.parse(filename)
self.pfx = {}
self.sfx = {}
self.sfx_cross = {}
self.pfx_cross = {}
def parse(self, filename):
with open(filename) as in... | StarcoderdataPython |
3333578 | from .camera import Camera
from .heartbeat import Heartbeat
from .mse_motor import Motor
from .mse_robot import Robot
from .image import bgr8_to_jpeg
from .object_detection import ObjectDetector | StarcoderdataPython |
3379345 | <gh_stars>0
import time
import igraph as ig
import agenspy.graph
if __name__ == '__main__':
kegg = agenspy.graph.Graph('kegg',
replace=True,
dbname='test')
graph= ig.Graph.Read_GraphMLz('graphs/kegg.graphml.gz')
print(len(graph.vs))
print(... | StarcoderdataPython |
9741 | <filename>muse_for_anything/api/v1_api/taxonomy_items.py
"""Module containing the taxonomy items API endpoints of the v1 API."""
from datetime import datetime
from sqlalchemy.sql.schema import Sequence
from muse_for_anything.db.models.taxonomies import (
Taxonomy,
TaxonomyItem,
TaxonomyItemRelation,
T... | StarcoderdataPython |
77009 | # Copyright 2014 Cisco Systems, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | StarcoderdataPython |
1010 | """
Utils for creating xdelta patches.
"""
import logging
from subprocess import check_output, CalledProcessError
from shutil import copyfile
from os import remove, path
class PatchChecksumError(Exception):
def __init__(self, message, errors):
super(PatchChecksumError, self).__init__(message)
class Patc... | StarcoderdataPython |
3288565 | <filename>src/Filter.py
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from scapy.all import *
class EmptyDelegate(QItemDelegate):
def __init__(self, parent):
super(EmptyDelegate, self).__init__(parent)
def creat... | StarcoderdataPython |
3398176 | <reponame>0xYoan/python_cherrytree<filename>tests/test_python_cherrytree.py
#!/usr/bin/env python
"""Tests for `python_cherrytree` package."""
import unittest
from python_cherrytree import python_cherrytree
class TestPython_cherrytree(unittest.TestCase):
"""Tests for `python_cherrytree` package."""
def s... | StarcoderdataPython |
3260671 | <reponame>hartescout/sqlite-dissect<filename>sqlite_dissect/utilities.py
from binascii import hexlify
from hashlib import md5
from logging import getLogger
from re import compile
from struct import pack
from struct import unpack
from sqlite_dissect.constants import ALL_ZEROS_REGEX
from sqlite_dissect.constants import L... | StarcoderdataPython |
1633060 | <filename>instance_data/problem_instance_generator.py
# MIT License
#
# Copyright (c) 2021 <NAME>
#
# 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 limitati... | StarcoderdataPython |
4833775 | <gh_stars>1-10
from __future__ import unicode_literals
from django.contrib import admin
from django.template.defaultfilters import truncatechars
from django.utils.translation import ugettext_lazy as _
from reviewboard.reviews.forms import DefaultReviewerForm, GroupForm
from reviewboard.reviews.models import (Comment,... | StarcoderdataPython |
1779881 | <filename>xml_extractions/common_xml_parser_function.py
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.