id
stringlengths
2
8
text
stringlengths
16
264k
dataset_id
stringclasses
1 value
9672359
<gh_stars>1-10 import keras import tensorflow as tf from keras.applications.vgg19 import VGG19 from keras.preprocessing import image from keras.applications.vgg19 import preprocess_input from keras.models import Model, Sequential, load_model from keras.optimizers import Adam from keras.layers import Dense from keras im...
StarcoderdataPython
3230461
<gh_stars>10-100 # -*- coding: utf-8 -*- from __future__ import unicode_literals import os try: import unittest2 as unittest except ImportError: import unittest try: from StringIO import StringIO except ImportError: # Python 3 from io import BytesIO as StringIO from mstranslator import AccessToken,...
StarcoderdataPython
1667859
# Generated by Django 2.1.1 on 2018-12-01 19:16 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('todo', '0001_initial'), ] operations = [ migrations.RenameModel( old_name='TodoModel', new_name='Todo', ), ]
StarcoderdataPython
4800884
from app import views, forms, app app.run()
StarcoderdataPython
3333965
#!/usr/bin/env python2.7 # # Copyright 2016 Cluster Labs, Inc. # # 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 applic...
StarcoderdataPython
6613586
import os import sys from numpy.distutils.exec_command import exec_command def installing(): status, output = exec_command('conda build . --no-anaconda-upload') status, output = exec_command('conda build . --output') status, output = exec_command('conda install --use-local '+output) status, output = e...
StarcoderdataPython
11224591
<gh_stars>1-10 # coding: utf-8 import pprint import re import six class ListTemplatesRequest: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name ...
StarcoderdataPython
214183
<filename>SVM/ExtractFeatureData/test.py<gh_stars>10-100 import os import datetime import pandas as pd from CommonFunction.extract_color_data import extract_color_data from CommonFunction.extract_SURF_data import extract_SURF_data from CommonFunction.extract_ELA_data import extract_ELA_data inputpath = 'G:/SVM/Celeba_...
StarcoderdataPython
6666972
<reponame>agooding-netizen/GildedRose-Refactoring-Kata<gh_stars>0 # -*- coding: utf-8 -*- import re class GildedRose(object): def __init__(self, items): self.items = items @staticmethod def upgrade(item, rate): if item.quality < 50-rate: item.quality += rate else: ...
StarcoderdataPython
1776046
<reponame>mesarcik/NLN def print_epoch(model_type,epoch,time,losses,AUC): """ Messages to print while training model_type (str): type of model_type epoch (int): The current epoch time (int): The time elapsed per Epoch losses (dict): the losses of the model AUC (dou...
StarcoderdataPython
249958
<filename>Latest/venv/Lib/site-packages/apptools/naming/object_factory.py #------------------------------------------------------------------------------ # Copyright (c) 2005, Enthought, Inc. # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought...
StarcoderdataPython
322671
<filename>lms/tests/test_exercise_unit_tests.py import os import pytest # type: ignore from lms.lmsdb import models from lms.lmstests.public.unittests import import_tests from lms.lmstests.public.unittests import executers from lms.lmstests.public.unittests import tasks from lms.models import notifications from lms....
StarcoderdataPython
5006576
from transformers import AutoTokenizer import torch lines=open('object_vocab.txt').readlines() tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased") vs=tokenizer.vocab_size sv = torch.zeros(len(lines), vs) for i, l in enumerate(lines): v=(tokenizer(l)['input_ids'][1:-1]) for vv in v: sv[i][vv] ...
StarcoderdataPython
1798114
<reponame>malywonsz/txtai """ Factory module """ from .sqlite import SQLite class DatabaseFactory: """ Methods to create document databases. """ @staticmethod def create(config): """ Create a Database. Args: config: database configuration parameters ...
StarcoderdataPython
3389428
<reponame>PinkRoccade-Local-Government-OSS/PinkWave<gh_stars>1-10 #!/usr/bin/python """ The Macro class can be used to load macro scripts written in Python """ import os from os.path import isfile import importlib from time import sleep import sys,os from os.path import dirname,abspath from os import walk # Importin...
StarcoderdataPython
5090742
<gh_stars>1-10 import os # Prepare dataset os.system("python ./prepare_dataset.py --images_dir ../data/ImageNet/original --output_dir ../data/ImageNet/SRGAN/train --image_size 96 --step 48 --num_workers 10") # Split train and valid os.system("python ./split_train_valid_dataset.py --train_images_dir ../data/ImageNet/S...
StarcoderdataPython
8003271
<filename>gamePlayer.py from gameElements import * import json import time import os import matplotlib.pyplot as plt import progressbar class GamePlay: def __init__(self, GameRunner): self.game = GameRunner self.boardsizeTrain = 3 self.boardsizeTest = 3 self.num_iterations_train = 100 self.num_iterations_...
StarcoderdataPython
6484889
#!/usr/bin/evn python import numpy as np import cv2 import glob import matplotlib.pyplot as plt from skimage.feature import peak_local_max import copy def corner_score(img): img = cv2.GaussianBlur(img,(3,3),0) gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) gray = np.float32(gray) dst = cv2.c...
StarcoderdataPython
205562
expected_output = { "track": { "1": { "type": "Interface", "instance": "Ethernet1/4", "subtrack": "IP Routing", "state": "DOWN", "change_count": 1, "last_change": "3w5d", "tracked_by": { ...
StarcoderdataPython
11399840
"""Shows a basic text dialog. """ import sys sys.path.append("..") from agpy.ui import * from agpy.window import * from agpy.utils import * sys.path.remove("..") def main(): show_window("Dialog test.") dlg("Hi!") dlg("Test again!") quit() if __name__ == "__main__": main()
StarcoderdataPython
3511099
<gh_stars>10-100 """This module is used to scrape the all of the APIs from a given source file and return their name and kind. These include classes, structs, functions, and certain variable types. It is not used to actually describe these elements. That is the job of the autodescriber. This module is available as a...
StarcoderdataPython
6638911
# encoding: utf-8 import pytest import six from bs4 import BeautifulSoup import ckan.model as model import ckan.tests.factories as factories import ckan.tests.helpers as helpers from ckan.common import config from ckan.lib.helpers import url_for from ckan.model.system_info import get_system_info @pytest.fixture def...
StarcoderdataPython
3411626
<filename>tests/category/collection_test.py from dataclasses import asdict, dataclass, field from typing import Generic, TypeVar from category import Vector T = TypeVar("T") def test_vector_init(): assert [] == Vector() == [] assert [] == Vector([]) == [] assert [] == Vector(()) == [] # assert [] ==...
StarcoderdataPython
5032084
<filename>cmdline/EncripionV2.py alphabet = 'abcdefghijklmnopqrstuvwxyz' i = 0 newMessage = '' keys=[3,1,4,1,5] message=input("Enter A Message:") for character in message: i=i+1 i=i % 4 if character in alphabet: position = alphabet.find(character) newPosition = (position + keys[i]) % 26 newCharacter = alphab...
StarcoderdataPython
163791
#!/usr/bin/env python3 """ User management script for the wireguard server """ import os import io import stat import shutil import sys import platform import argparse import hashlib import crypt import logging import secrets import string import subprocess import pathlib class OperationError(Exception): '''r...
StarcoderdataPython
12822887
<reponame>vlukes/io3d #! /usr/bin/env python # -*- coding: utf-8 -*- """ Module for readin 3D dicom data """ # import funkcí z jiného adresáře import sys import os.path # path_to_script = os.path.dirname(os.path.abspath(__file__)) # sys.path.append(os.path.join(path_to_script, "../extern/pyseg_base/src")) # sys.path....
StarcoderdataPython
8057783
from keras.datasets import cifar10 from PIL import Image import numpy as np import os (x_train, y_train), (x_test, y_test) = cifar10.load_data() max_num_datas = 1000 num_classes = 4 num_datas_list = np.zeros(num_classes) img_dir = "../data" id = 0 for x, y in zip(x_train, y_train): if np.sum(num_datas_list) > ...
StarcoderdataPython
3427260
# Create a program that takes an IP address entered at the keyboard # and prints out the number of segments it contains, and the length of each segment. # # An IP address consists of 4 numbers, separated from each other with a full stop. But # your program should just count however many are entered # Examples of the in...
StarcoderdataPython
9662822
<gh_stars>0 from psutil import virtual_memory def check_memory(): mem = virtual_memory() return mem.percent
StarcoderdataPython
87468
# MyFirstControllerの__init__メソッド内に追加する self.jointIndex = 0 self.goingLeft = True
StarcoderdataPython
3234507
import mock import os import unittest import shutil from rf_runner.fetcher import AbstractFetcher, LocalFetcher, ZipFetcher from rf_runner.fetcher_factory import FetcherFactory lf_config = {'src': 'testcases'} zf_config = {'url': 'https://github.com/devopsspiral/rf-service/archive/master.zip'} zfp_config = {'url': 'ht...
StarcoderdataPython
9601753
import os import re import subprocess import asyncio import shlex import magic from alot.buffers import EnvelopeBuffer, SearchBuffer from alot.commands import CommandCanceled from alot.helper import mailto_to_envelope from alot.settings.const import settings from alot.settings.errors import NoMatchingAccount from notmu...
StarcoderdataPython
1991373
import time import json import paho.mqtt.client as mqtt def spiral(client, boule, temps): cmds = [] resets = [] order = [10, 2, 7, 4, 12, 0, 6, 5, 11, 1, 3, 8, 9] for i in order: center = i / 12 * 3 * 256 R = max([0, 255 - center, center - 2*256]) G = abs(255 - center) if center < 2*256-1 else 0 B = abs(2*...
StarcoderdataPython
3386158
import numpy as np import copy from sklearn.linear_model import LogisticRegression, SGDClassifier class ClassifierChain() : ''' Classifier Chain ---------------- TODO: much of this can be shared with Regressor Chains, and thus probably we should use some kind of base class to inhe...
StarcoderdataPython
5024764
<reponame>Dheeraj8383/pcb-tools<gh_stars>100-1000 #! /usr/bin/env python # -*- coding: utf-8 -*- # copyright 2014 <NAME> <<EMAIL>> # copyright 2014 <NAME> <<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 ...
StarcoderdataPython
9783714
<gh_stars>0 import datetime import functools # import logging import numpy as np import pandas as pd from . import smoothing from . import study_constants as constants LENGTH_OF_COMPLETE_DAY = 24 * 60 / 3 ONE_MONTH_IN_DAYS = 365.0 / 12 BASE_FEATURES = [ 'AllMeters', 'BodyMass', 'Food', 'KCal_hr', 'PedMeters', 'P...
StarcoderdataPython
5174866
<filename>mspray/apps/trials/migrations/0003_sample_bgeom.py # -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2018-08-10 15:18 from __future__ import unicode_literals import django.contrib.gis.db.models.fields from django.db import migrations class Migration(migrations.Migration): dependencies = [ ...
StarcoderdataPython
6662584
<gh_stars>0 # Copyright 2013 IBM Corp. # # 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...
StarcoderdataPython
1778994
<reponame>tiboun/python-bigquery-test-kit # Copyright (c) 2020 <NAME> # # This software is released under the MIT License. # https://opensource.org/licenses/MIT # C0114 disabled because this module contains only one class # pylint: disable=C0114 from copy import deepcopy from typing import Optional from google.cloud...
StarcoderdataPython
3261230
<filename>modeling/blender/test_util.py """ Tests for blender utilities. """ # Copryight (c) 2020 <NAME>. All rights reserved. from unittest.mock import Mock from modeling.blender import util def test_flatten(): """test flattening node structures""" n_a = 'a' n_b = 'b' n_c = 'c' struct = [n...
StarcoderdataPython
4845412
firstname = input('Input Here First Name: ') lastname = input('Input Here Last Name ') print(lastname[::-1] + ' ' + firstname[::-1] )
StarcoderdataPython
6587397
<filename>zwiz/_utils.py<gh_stars>0 """This module contains utility classes related to scraping HS3 website""" import re # pylint: disable=C0103 # Non-snake variable names # pylint: disable=R0902 # Many instances # pylint: disable=R0903 # Few public methods class Node: """ This is a conveniance class h...
StarcoderdataPython
1603479
import networkx as nx import numpy as np from sklearn.feature_extraction.text import TfidfVectorizer, TfidfTransformer, CountVectorizer from sklearn.metrics.pairwise import cosine_similarity from sumy.utils import get_stop_words import re import math import warnings warnings.simplefilter("ignore", UserWarning) class...
StarcoderdataPython
8130240
from typing import Type, Any, List, Dict, Set, Tuple, Union, Optional, Iterator, Iterable from Helpers.Graph import Pps2DGraph, PpsHyperGraph, PpsLogHyperGraph from Helpers.Torches import * from Helpers.GlobalSettings import Gs, Gsv from Models.CommonLayers import FeatureInteractor from Dataset import GraphDataset cl...
StarcoderdataPython
63745
# Based on https://github.com/eklitzke/utxodump from typing import Tuple import binascii import leveldb import config import json import os def decode_varint(val: bytearray) -> Tuple[int, int]: n = 0 for i, c in enumerate(val): n = (n << 7) | (c & 0x7f) if c & 0x80: n += 1 else: return n, i + 1 assert F...
StarcoderdataPython
9623387
<filename>esmvalcore/preprocessor/_derive/rtnt.py """Derivation of variable `rtnt`.""" from iris import Constraint from ._baseclass import DerivedVariableBase class DerivedVariable(DerivedVariableBase): """Derivation of variable `rtnt`.""" @staticmethod def required(project): """Declare the var...
StarcoderdataPython
11214172
# -*- coding: utf-8 -*- """ Created on Mon Aug 30 17:48:44 2021 @author: HP """ from selenium import webdriver from selenium.webdriver.support.ui import Select import pandas import time from bs4 import BeautifulSoup from selenium.common.exceptions import ElementClickInterceptedException, StaleElementReferenceException...
StarcoderdataPython
3509468
"""Common statistical modelling code.""" import numpy as np def multivariate_normal_pdf(x, mean, cov): """Unnormalized multivariate normal probability density function.""" # Convert to ndarray x = np.asanyarray(x) mean = np.asanyarray(mean) cov = np.asarray(cov) # Deviation from mean ...
StarcoderdataPython
1686389
from typing import List, Callable, Dict, Any, Tuple, NamedTuple import numpy as np import tensorflow as tf import tensorflow.contrib.layers as tf_layers from tensorflow.python.ops import template as template_ops from tqdm import tqdm from glow import flow_layers as fl from glow import tf_ops from glow import tf_ops a...
StarcoderdataPython
11210029
<gh_stars>0 import pandas as pd import datetime import seaborn as sns import matplotlib.pyplot as plt ### Utils ### def scores2file(score_map, output_file, sep=" "): """Export scores to .csv files""" score_df = pd.DataFrame(score_map, columns=["node_id","score"]) score_df.to_csv(output_file,sep=sep, heade...
StarcoderdataPython
1873482
<gh_stars>100-1000 # coding=utf-8 import logging import time import numpy as np import sys import copy from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams from experiments.config import setup_lcsts from emolga.utils.generic_utils import * from emolga.models.covc_encdec import NRM from emolga.models.e...
StarcoderdataPython
11328281
# -*- coding: utf-8 -*- """ *Google search* Plugin ---------------------- Searches Google Usage:: .g Nyan cat """ import itertools import utils.plugin from google import search def gsearch_internal(query): return search(query, stop=3) def gsearch(server=None, channel=None, nick=None, text=None, **kw...
StarcoderdataPython
144373
import numpy as np from wrappa import WrappaObject, WrappaImage class DSModel: def __init__(self, **kwargs): pass def predict(self, data, **kwargs): _ = kwargs # Data is always an array of WrappaObjects responses = [] for obj in data: img = obj.image.as_n...
StarcoderdataPython
232107
<filename>baidu.py import os from selenium import webdriver from selenium.common.exceptions import (NoAlertPresentException, NoSuchElementException) from selenium.webdriver import FirefoxOptions as FFO from selenium.webdriver.chrome import options profile_dir = os.geten...
StarcoderdataPython
11309133
import logging from .ava_eval import do_ava_evaluation def ava_evaluation(dataset, predictions, output_folder, **_): logger = logging.getLogger("alphaction.inference") logger.info("performing ava evaluation.") return do_ava_evaluation( dataset=dataset, predictions=predictions, outp...
StarcoderdataPython
103183
<filename>Scripts/HighLayer/GenePrioritization/src/FormatFileQTLR.py #!/usr/bin/python2 import fileinput import sys # Format Genotyped file (GeneNetwork Format) into a text file for QTL/R # Require a phenotype file (tab-delimited) with a header and row name in 1st column (example BXD_trait.txt) # Usage: ./FormatFil...
StarcoderdataPython
1752792
<filename>creational/singleton/monostate.py<gh_stars>0 class CEO: _shared_state = { 'name': 'Steve', 'age': 55 } def __init__(self): self.__dict__ = self._shared_state def __str__(self): return f'{self.name} is {self.age} years old' if __name__ == '__main__': ...
StarcoderdataPython
1982639
<gh_stars>1-10 from __future__ import unicode_literals __version__ = '2018.03.20'
StarcoderdataPython
3309559
<filename>L1TriggerConfig/GMTConfigProducers/python/L1MuGMTRSKeysOnline_cfi.py import FWCore.ParameterSet.Config as cms L1MuGMTRSKeysOnline = cms.ESProducer("L1MuGMTRSKeysOnlineProd", onlineAuthentication = cms.string('.'), subsystemLabel = cms.string('L1MuGMT'), onlineDB = cms.string('oracle://CMS_OMDS_LB/...
StarcoderdataPython
3200448
<gh_stars>0 #venv/bin/python # -*- coding:utf-8 -*- from random import randint from random import choice from logbook import Logger, TimedRotatingFileHandler import os import sys # BASE_DIR = os.path.abspath(os.path.join(os.getcwd(), "..")) # sys.path.append(BASE_DIR) handler = TimedRotatingFileHandler('../logs/lott...
StarcoderdataPython
11266762
# Licensed under the MIT license # http://opensource.org/licenses/mit-license.php # a backend # Copyright 2007, <NAME> <<EMAIL>> # Copyright 2008, <NAME> <<EMAIL>> import re from coherence.backend import BackendItem, Container, AbstractBackendStore from coherence.upnp.core import DIDLLite from coherence...
StarcoderdataPython
9778322
import os import sys import subprocess from pathlib import Path import Utils from io import BytesIO from urllib.request import urlopen class VulkanConfiguration: requiredVulkanVersion = "172.16.58.3" vulkanDirectory = "./Corby/vendor/VulkanSDK" @classmethod def Validate(cls): if (not cls.Che...
StarcoderdataPython
11233885
<filename>partition_data.py import glob import sys import os import random import pdb from PIL import Image, ImageOps import cPickle as pickle import numpy as np from scipy import misc from constants import * if not os.path.isdir(BLOB_TRAIN_IMAGE_DIR): os.makedirs(BLOB_TRAIN_IMAGE_DIR) if not os.path.isdir(BLOB_T...
StarcoderdataPython
4838826
<gh_stars>1-10 #!/usr/bin/env python import networkx as nx from collections import defaultdict def neighbors(grid, p): height = len(grid) width = len(grid[0]) px, py = p if px == 0 or py == 0 or px == width-1 or py == height-1: return [] return [ (p[0], p[1]-1), (p[0], p...
StarcoderdataPython
1665085
"""This is an example of how to use the simple sqlfluff api.""" import sqlfluff # -------- LINTING ---------- my_bad_query = "SeLEct *, 1, blah as fOO from myTable" # Lint the given string and return an array of violations in JSON representation. lint_result = sqlfluff.lint(my_bad_query, dialect="bigquery") # l...
StarcoderdataPython
1937963
from azure.storage.fileshare import ShareServiceClient def main(): # Create a file share client share_client = ShareServiceClient.from_connection_string( "DefaultEndpointsProtocol=https;AccountName=<account_name>;AccountKey=<account_key>;EndpointSuffix=core.windows.net") # Create a file share ...
StarcoderdataPython
333387
<filename>tests/test_client.py from jina.clients import py_client from jina.clients.python import PyClient from jina.flow import Flow from jina.proto.jina_pb2 import Document from tests import JinaTestCase class MyTestCase(JinaTestCase): def test_client(self): f = Flow().add(yaml_path='_forward') ...
StarcoderdataPython
3367999
<filename>day11/script2.py<gh_stars>0 import numpy as np # TODO : this works but takes forever # TODO : Would be smarter to calculate all blocks starting at a given position # TODO : to re-use the previous calculation each time SIZE = 300 # fuel matrix size def power(x, y, serial): rack_id = x + 10 ...
StarcoderdataPython
6409612
<filename>examples/plot_neurosynth_implementation.py # -*- coding: utf-8 -*- r""" NeuroLang Example based Implementing a NeuroSynth Query ==================================================== """ # %% import warnings warnings.filterwarnings("ignore") from pathlib import Path from typing import Iterable import nibab...
StarcoderdataPython
4843571
# Generated by Django 2.1.2 on 2018-10-03 23:58 from django.db import migrations, models import uuid class Migration(migrations.Migration): initial = True dependencies = [ ('auth', '0009_alter_user_last_name_max_length'), ] operations = [ migrations.CreateModel( name='U...
StarcoderdataPython
9646205
<filename>View/telaAbrirProjeto.py from tkinter import * from Controller import controleBanco # Tela que mostra os projetos existentes def TelaAbrirProjeto(tela): # Cria a tela telaAbrir = Toplevel(tela) telaAbrir.title('ABRIR PROJETO') telaAbrir.geometry('300x250+620+120') telaAbrir['bg'] = 'gra...
StarcoderdataPython
8157750
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torchbearer from torchbearer import cite IMAGE = torchbearer.state_key('image') """ State key under which to hold the image being ascended on """ _stanley2007compositional = """ @article{stanley2007compositio...
StarcoderdataPython
6639052
import os import webapp2 import jinja2 from google.appengine.api import users import logging #Jinja Loader template_env = jinja2.Environment( loader=jinja2.FileSystemLoader(os.getcwd())) from main import Account,Settings,PostalAddress,PhysicalAddress,Drive,ProjectArt,Wallet import time class NavigationHandler(w...
StarcoderdataPython
6515402
<filename>src/models/wisenet_base/test.py import torch import torch.nn as nn from torch.utils import data import numpy as np import pickle import cv2 from torch.autograd import Variable import torch.optim as optim import scipy.misc import sys import os import os.path as osp import datetime import random import timeit, ...
StarcoderdataPython
11252433
<reponame>JacksonCrawford/relational_contracts import foundation import requests from bs4 import BeautifulSoup import json import time import random year = input("Enter a year: ") startTime = time.time() # Uses requests to navigate to the Wired sitemap and grab all data under the specified class page = requests.get(...
StarcoderdataPython
8055073
from sklearn.linear_model import LogisticRegression import numpy as np def train_and_predict(X_train, X_valid, y_train, y_valid, X_test, params, fold_ind, scoring): """train_and_predict train and evaluate the model and predict targets. The interface is same across any ML algorithms....
StarcoderdataPython
3391070
<reponame>tomchuk/meetup_20160428<gh_stars>0 from django.conf.urls import url, include from rest_framework import routers from todo import views as todo_views router = routers.DefaultRouter() router.register(r'todos', todo_views.TodoViewSet, base_name='todo') urlpatterns = [ url(r'^$', todo_views.index, name='i...
StarcoderdataPython
6619103
#<NAME> #ITP_449, Spring 2020 #HW02 #Question 3 import re def main(): ask = input("Please enter your password:") while True: if (len(ask) < 8): print(":( Try Again") ask = input("Please enter your password:") elif not re.search("[a-z]", ask): print(":( Try Ag...
StarcoderdataPython
79938
import yaml import numpy as np from os import path from absl import flags from pysc2.env import sc2_env from pysc2.lib import features from pysc2.lib import actions sc2_f_path = path.abspath(path.join(path.dirname(__file__), "..", "configs", "sc2_config.yml")) with open(sc2_f_path, 'r') as ymlfile: sc2_cfg = yam...
StarcoderdataPython
1998505
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2014-18 <NAME> and contributors # See LICENSE.rst for details. # PYTHON_ARGCOMPLETE_OK """ Scrolling artist + song and play/pause indicator """ import os import time from PIL import ImageFont, Image, ImageDraw from demo_opts import get_device from luma.cor...
StarcoderdataPython
9672298
<filename>b0mb3r/app/routers/attack.py<gh_stars>0 import asyncio import re import uuid import phonenumbers from fastapi import APIRouter, HTTPException from loguru import logger from b0mb3r.app.models import AttackModel, StatusModel from b0mb3r.app.status import status from b0mb3r.main import perform_attack router =...
StarcoderdataPython
5115039
<reponame>Needoliprane/ThePhantomOfTheOpera from GameClass.Player import Player class Joseph(Player): def actions(self, room, otherPerson, otherPersons): if self.room.isOn() == True: self.room.switchOffTheLight() else: self.room.switchOnTheLight()
StarcoderdataPython
8178391
<reponame>AltimateAI/pyconcrete<filename>test/test_exe_testcases.py #!/usr/bin/env python # -*- coding: utf8 -*- # Create on : 2019/07/13 from __future__ import unicode_literals import os from os.path import join from test import base from test.utility import ImportedTestCase, ImportedTestCaseError class TestExe(ba...
StarcoderdataPython
6530106
import smart_imports smart_imports.all() ######################################## # processors ######################################## class EmissaryProcessor(utils_views.ArgumentProcessor): CONTEXT_NAME = 'current_emissary' DEFAULT_VALUE = None ERROR_MESSAGE = 'Неверный идентификатор эмиссара' d...
StarcoderdataPython
12802642
# MIT License # # Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. # # 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 th...
StarcoderdataPython
5082457
from .data_utils import *
StarcoderdataPython
3434407
#!/usr/bin/python ############################################################### # Copyright (c) 2017 ZTE Corporation # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at ...
StarcoderdataPython
9675810
<gh_stars>10-100 # delete the API client with name 'my_api_client' client.delete_api_clients(names=['my_api_client']) # Other valid fields: ids # See section "Common Fields" for examples
StarcoderdataPython
69518
<reponame>scottsilverlabs/raspberrystem-hw-base from bs4 import BeautifulSoup import sys try: prog, name = sys.argv except: print "Usage: eagle-hflip.py <file> <scale_factor> " sys.exit() with file(name) as f: soup = BeautifulSoup(f) for tag in soup.plain.find_all(["vertex", "polygon", "wire"]): ...
StarcoderdataPython
6571323
<reponame>restinya/Barkeep<filename>coggers/reward.py import discord import asyncio import requests import re from discord.utils import get from discord.ext import commands from math import floor from configs.settings import command_prefix from utils import accessDB, point_buy, alpha_emojis, db, VerboseMDStrin...
StarcoderdataPython
294013
import pandas as pd def get_county_data(state_name: str = "Colorado"): df = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/minoritymajority.csv") df.loc[:, "ServiceArea"] = False return df[df["STNAME"] == state_name]
StarcoderdataPython
8036729
<filename>setup.py """setuptools packaging.""" import setuptools setuptools.setup( name="docker_kafka_reconciliation", version="0.0.1", author="<NAME>", author_email="<EMAIL>", description="Submits Kafka reconciliation queries to Athena and uploads the results to S3", entry_points={ "c...
StarcoderdataPython
1945244
<filename>modules/sbot/robot.py<gh_stars>0 from __future__ import annotations import math import random from os import path, environ from typing import Optional from threading import Lock from sbot import motor, radio, magnet, arduino, compass, encoder # Webots specific library from controller import Robot as WebotsR...
StarcoderdataPython
5195230
import cv2 try: image = cv2.imread('image/lego.jpg') (height, width) = image.shape[:2] res = cv2.resize(image, (int(width / 2), int(height / 2)), interpolation=cv2.INTER_CUBIC) cv2.imshow('Image Edge Detection', res) k = cv2.waitKey(0) & 0xFF if k == 27: cv2.destroyAllWindows() ...
StarcoderdataPython
9653486
# Copyright 2018 Google LLC. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # #...
StarcoderdataPython
5067903
# 响应状态码、响应头、响应体 # 1. 发起请求 requests.[method](url) 返回响应对象 # 2. resp.status_code 响应状态码 # resp.headers 响应头 # resp.content 字节码数据 # resp.text 字符串 import requests resp = requests.get('http://www.baidu.com') status_code = resp.status_code print(f'响应状态码:{status_code}') headers = resp.headers # 字典 print('响应头') print(head...
StarcoderdataPython
3413954
<filename>Chapter03/ch03_ex1.py<gh_stars>10-100 #!/usr/bin/env python3 """Functional Python Programming Chapter 3, Example Set 1 """ from typing import Callable class Mersenne1: """Callable object with a **Strategy** plug in required.""" def __init__(self, algorithm: Callable[[int], int]) -> None: sel...
StarcoderdataPython
3363190
<reponame>tor-councilmatic/scrapers-ca from __future__ import unicode_literals from utils import CanadianScraper, CanadianPerson as Person COUNCIL_PAGE = 'http://www.gov.mb.ca/legislature/members/mla_list_alphabetical.html' def get_party(abbreviation): return { 'NDP': 'New Democratic Party of Manitoba', ...
StarcoderdataPython
9620698
import ip_publica as publica from subprocess import Popen, PIPE, STDOUT import os #prueba con los colores# from colorama import Fore, init, Back, Style BIENVENIDA = ''' ______ _ _ _ (____ \(_) (_) | | ____) )_ ____ ____ _ _ ____ ____ _ ...
StarcoderdataPython
4919422
#!/usr/bin/env python # -*- coding: utf-8 -*- # # @Author: <NAME> (<EMAIL>) # @Date: 2020-07-29 # @Filename: test_configuration.py # @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause) import inspect import io import os import unittest.mock import pytest from sdsstools import Configuration, get_...
StarcoderdataPython