id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
104366
# Copyright (c) 2012 <NAME> # ======================================================================= # Distributed under the MIT License. # (See accompanying file LICENSE or copy at # http://opensource.org/licenses/MIT) # ======================================================================= """ pytest for area_z...
StarcoderdataPython
3200255
from kivy.factory import Factory from kivy.properties import NumericProperty, BooleanProperty from kivy.uix.boxlayout import BoxLayout from kivy.uix.label import Label from cobiv.modules.core.component import Component class StatusLabel(Component, Label): def __init__(self, **kwargs): super(StatusLabel, ...
StarcoderdataPython
179647
<filename>migrations/versions/c45a6b3de513_.py """empty message Revision ID: c45a6b3de513 Revises: Create Date: 2016-11-29 21:00:18.340073 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'c45a6b3de513' down_revision = None branch_labels = None depends_on = Non...
StarcoderdataPython
1704077
import cv2 import numpy as np import tensorflow as tf from numpy.linalg import inv from scipy import sparse def getLaplacian1(I,consts,win_size = 1,eps = 1e-5): neb_size = (win_size*2+1)*(win_size*2+1) h,w,c = I.shape n = h m = w img_size = w*h consts = cv2.erode(consts,-1,element = np.ones(wi...
StarcoderdataPython
3323031
from abc import ABCMeta, abstractmethod class TrainEvalTrigger(metaclass=ABCMeta): """ TrainEvalTrigger class. This abstract class defines the minimum requirements of a trigger. It provides an interface to define criteria when data shall be fitted and evaluated. Raises ------ NotImplementedE...
StarcoderdataPython
1676167
<gh_stars>0 from dataclasses import dataclass from marshmallow import fields, Schema, post_load from flask import Flask, jsonify, request from flask_accepts import accepts, responds @dataclass class Widget: foo: str baz: int class WidgetSchema(Schema): foo = fields.String(default="test value") baz =...
StarcoderdataPython
3266253
<gh_stars>100-1000 from django.conf import settings def social_app_keys(request): return { 'facebook_key': settings.SOCIAL_AUTH_FACEBOOK_KEY, 'googleoauth2_key': settings.SOCIAL_AUTH_GOOGLE_OAUTH2_KEY, }
StarcoderdataPython
166053
<reponame>AutreTechLab/ATL_WEBOTS_ROS2_bridge<filename>simulation/webots_project/controllers/atl_thymio/atl_thymio.py """atl_thymio controller.""" # You may need to import some classes of the controller module. Ex: # from controller import Robot, Motor, DistanceSensor from controller import Robot import math # creat...
StarcoderdataPython
3238061
"""Collection of routines used to post process (magnetisation) vector data. Part of ovf2vtk. <NAME>, <EMAIL> # Some helping functions: # # Set of functions used for ovf2vtk. General data format is a rank-2 # matrix with the row corresponding to the data in the vector field, and # the 3-component column correspondin...
StarcoderdataPython
185920
<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Mon Mar 30 21:44:44 2020 @author: <NAME> """ #%%import libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt #%% read csv dataset = pd.read_csv("logistic_regression_dataset.csv") dataset.drop(["Unnamed: 32","id"],axis = 1, inplace = True...
StarcoderdataPython
1781230
<reponame>aktkyuyo/xml2cpp import xlrd import re import os from xml.dom.minidom import parse import xml.dom.minidom # 使用minidom解析器打开 XML 文档 DOMTree = xml.dom.minidom.parse("xlspath.xml") collection = DOMTree.documentElement # xlsdata_path = collection.getElementsByTagName("xlsdata_path")[0].childNodes[0].data xlsna...
StarcoderdataPython
1763459
# the upload dir UPLOAD_FOLDER = '/home/gk07/tmp/easytransfer' # flask server host SERVER_HOST = '0.0.0.0' # flask server port SERVER_PORT = 5678 # datetime_format = '%Y-%m-%d %H:%M:%S' msg_cache = 'msg_cache' # The max num of messages MAX_MSG = 20 # Files with belowing extensions are forbiden to upload. FORBIDEN_EXTE...
StarcoderdataPython
3388668
from django.db import models class Match(models.Model): match_id = models.CharField(max_length=15) summary_json = models.JSONField(default=dict) summoner = models.CharField(max_length=50) class Meta: ordering = ['id'] def __str__(self): return self.match_id
StarcoderdataPython
3220011
# -*- coding: utf-8 -*- """ pyxtal_step A SEAMM plug-in for PyXtal """ # Bring up the classes so that they appear to be directly in # the pyxtal_step package. from pyxtal_step.pyxtal import PyXtal # noqa: F401 from pyxtal_step.pyxtal_parameters import PyXtalParameters # noqa: F401 from pyxtal_step.pyxtal_step impo...
StarcoderdataPython
109396
from collections import deque class Solution(object): def isValid(self, s): """ :type s: str :rtype: bool """ d = deque([]) started = False opening = ['[', '{', '('] closing = [']', '}', ')'] pairs = {']': '[', '}': '{', ')': '('} op...
StarcoderdataPython
1700331
<filename>crow/views.py<gh_stars>0 from pyramid.view import view_config, view_defaults @view_config(route_name='home', renderer='home.mako') def home_view(request): return {'title': 'CROW | Centralized Remote Observations Website'} @view_defaults(route_name='sources') class SourcesREST(object): def __init__...
StarcoderdataPython
5263
<filename>test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_operations.py<gh_stars>0 # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT Lic...
StarcoderdataPython
47495
<gh_stars>100-1000 import pytest import sqlalchemy as sa from sqlalchemy_utils import get_referencing_foreign_keys class TestGetReferencingFksWithCompositeKeys(object): @pytest.fixture def User(self, Base): class User(Base): __tablename__ = 'user' first_name = sa.Column(sa.Un...
StarcoderdataPython
4835917
<reponame>Rakib1508/django-sales-stat<filename>sales/forms.py<gh_stars>0 from django import forms CHART_CHOICES = ( ('#1', 'Bar Chart'), ('#2', 'Pie Chart'), ('#3', 'Line Chart'), ) RESULT_CHOICES = ( ('#1', 'Transaction ID'), ('#2', 'Sales Date'), ) class SalesSearchForm(forms.Form): date_...
StarcoderdataPython
149479
# -*- coding: utf-8 -*- # Copyright (C) 2013 Mag. <NAME> All rights reserved # Glasauergasse 32, A--1130 Wien, Austria. <EMAIL> # #*** <License> ************************************************************# # This module is part of the package GTW.OMP.PAP. # # This module is licensed under the terms of the BSD 3-Claus...
StarcoderdataPython
3269357
<filename>beta 2.0/spam_vk2.py """ Программа для спама в vk. Beta 2.0. Автор: <NAME>. """ import pyautogui as pg # Настройка и подготовка к спаму. # Включает отказоустойчивый режим. # Перемещение мышь в верхний левый угол вызовет, pyautogui.FailSafeException который может прервать вашу программу. protection = pg.FAIL...
StarcoderdataPython
3265618
import requests url = "http://192.168.86.192/targetcmd/" req = requests.request("get", url + "rawBusControlOn") print(req.json()) req = requests.request("get", url + "rawBusWaitDisable") req = requests.request("get", url + "rawBusWaitClear") req = requests.request("get", url + "rawBusTake") ramRomPageWrBase = '70' ra...
StarcoderdataPython
1615283
<reponame>fredstro/sage r""" Bases for `NCSym`. AUTHORS: - <NAME> (08-04-2013): Initial version """ #***************************************************************************** # Copyright (C) 2013 <NAME> <tscrim at ucdavis.edu> # # Distributed under the terms of the GNU General Public License (GPL) # ...
StarcoderdataPython
1728448
""" Stores the reference set and meat information of the hybrid optimization run. """ from .reference_set import ReferenceSet class OptimizationResult: """ Stores result of the hybrid optimization run. """ def __init__(self, reference_set: ReferenceSet): self.reference_set =...
StarcoderdataPython
164550
# Copyright 2021 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Test the zmake re-exec functionality.""" import os import sys import unittest.mock as mock import pytest import zmake.__main__ as main @pytest.fixt...
StarcoderdataPython
1643221
<reponame>Miker2808/PyRoboteq from PyRoboteq import RoboteqHandler import time controller = RoboteqHandler() connected = controller.connect("COM9") if __name__ == "__main__": while connected: controller.dual_motor_control(200, 200)
StarcoderdataPython
1740382
<reponame>dan-haessler/dezibot # Linear Velocity: m/s # Angular Velocity: rad/s class Velocity: def __init__(self, velocity): self.linear = velocity[0:3] self.angular = velocity[3:6] def round(self, lPrec, aPrec): self.linear = [round(v, lPrec) for v in self.linear] self.angular = [round(v, aPrec) ...
StarcoderdataPython
173470
""" Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL. Initially, all next pointers are set to NULL. Note: You may only use...
StarcoderdataPython
1681986
<filename>bench/benchmark.py # todo combine benchmarks of scorers into common code base import timeit import pandas import numpy as np def benchmark(name, func, setup, lengths, count): print(f"starting {name}") start = timeit.default_timer() results = [] for length in lengths: test = timeit.Tim...
StarcoderdataPython
66035
import cv2 from tkinter import Tk from tkinter.filedialog import askopenfilename import numpy as np import imutils import threading def main(): cap = cv2.VideoCapture(vid_path) status1, previous_frame = cap.read() total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT)) copy_frame ...
StarcoderdataPython
1682092
<gh_stars>1-10 import sys from collections import deque def bfs(x, y): dx = [1, 0, -1, 0] dy = [0, 1, 0, -1] q = deque([(x, y)]) visited = [[False] * N for _ in range(N)] time = 0 visited[x][y] = True shark_size = 2 eat = 0 flag = False result = 0 while q: size = len...
StarcoderdataPython
3286989
#! /usr/bin/env python # This is a sample code for encrypted state feedback. # The following is the original paper's information (but it uses output # feedback): # <NAME>, <NAME>, and <NAME>, Secure and private control using # semi-homomorphic encryption, Control Engineering Practice, vol. 67, # pp. 13–20, 2017. impo...
StarcoderdataPython
3268192
import io import json import os import sys from contextlib import contextmanager import isort if sys.version_info[0] >= 3: from pathlib import Path sys.dont_write_bytecode = True @contextmanager def silence_stdout(): new_target = open(os.devnull, "w") old_target, sys.stdout = sys.stdout, new_target ...
StarcoderdataPython
3392384
<filename>generator/contact.py from model.contact import Contact import random import string import os.path import jsonpickle import getopt import sys try: opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["numbers of contact", "file"]) except getopt.GetoptError as err: getopt.usage() sys.exit(2) n = ...
StarcoderdataPython
3235027
import os import logging import yaml import boto3 from boto3 import s3 from botocore.exceptions import ClientError from kubernetes import client, config from kubernetes.client.rest import ApiException logging.basicConfig( level=logging.INFO, format="%(asctime)s:%(levelname)s:%(message)s" ) s3 = boto3.resourc...
StarcoderdataPython
1670383
<filename>matlab_ext/code-miners/projects/pysnmp-generators/_parsers/__init__.py # coding: utf-8 from util import file_as_list def parse_update(mib_map, access_map): def recode(file_name): keys_list = file_as_list(file_name) keys_dict = {} for k in keys_list: key = k.split(' ')[...
StarcoderdataPython
138434
import numpy as np import pandas as pd import matplotlib.pyplot as plt
StarcoderdataPython
3293997
<gh_stars>0 from project import music_player music_player.main()
StarcoderdataPython
53915
<filename>ude/communication/grpc_auth.py ################################################################################# # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # # # Licensed under the Apache Lic...
StarcoderdataPython
3360386
import sys import os.path from functools import reduce from nltk.tokenize import sent_tokenize, word_tokenize import simple_sum as simsum import txt_differences as txt_dif OUT_SEN_COUNT = 45 IN_SEN_COUNT = 50 IMP_NOUN_WEIGHT = 1.5 FIN_SUM_WORD_COUNT = 1000 # Also stolen from the interwebs # https://stackoverflow.c...
StarcoderdataPython
1783302
# -*- coding:utf-8 -*- import os import sys import logging from optparse import OptionParser sys.path.append(os.sep.join( os.path.dirname(os.path.abspath(__file__)).split(os.sep)[:-1])) import libcloud_rest.log from libcloud_rest.log import get_logger from libcloud_rest.constants import VALID_LOG_LEVELS DEBUG = ...
StarcoderdataPython
30632
import zebra from workflow import Workflow if __name === '__main__': wf = Workflow() wf.cache_data('zebra_all_projects', zebra.get_all_projects()) wf.cache_data('zebra_aliased_activities', zebra.get_aliased_activities())
StarcoderdataPython
1636986
<reponame>neuromusic/PartSeg # pylint: disable=R0201 import numpy as np import pytest from PartSegCore.image_operations import gaussian, median class TestImageOperation: @pytest.mark.parametrize("dims", [2, 3, 4]) @pytest.mark.parametrize("method", [gaussian, median]) @pytest.mark.parametrize("per_layer...
StarcoderdataPython
4816577
from googletrans import Translator from rich.console import Console console = Console() class translateit(): def __init__(self): self.setup() def setup(self): """ Declaring a translator object to be used in the other functions :return: """ self.translator = ...
StarcoderdataPython
3213655
<reponame>CaiWZ/ReSysChallenge2015<gh_stars>0 import torch from sklearn.preprocessing import LabelEncoder from torch_geometric.data import Data from torch_geometric.data import InMemoryDataset from tqdm import tqdm # from config import process_path df = torch.load('data/yoochoose_click_binary_1M_sess.dataset') clas...
StarcoderdataPython
1761783
<reponame>hollyfoxx/ace2-gui from sqlalchemy import Column, ForeignKey, Table from sqlalchemy.dialects.postgresql import UUID from db.database import Base node_threat_mapping = Table( "node_threat_mapping", Base.metadata, Column( "node_uuid", UUID(as_uuid=True), ForeignKey("node.u...
StarcoderdataPython
4823833
<reponame>rootless4real/cozmo-python-sdk #!/usr/bin/env python3 # Copyright (c) 2018 Anki, 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 in the file LICENSE.txt or at # # http://www....
StarcoderdataPython
1772144
#------------------------------------------------------------------------------- # Name: CONNECT 4 GAME # Purpose: PROJECT FOR GAME DEVELOPMENT IN OOP # # Author: <NAME>, PASCUAL, LAURENT, VENERACION # # Created: 30/10/2019 # Copyright: (c) XENON_XEIN_XENLY 2019 # Licence: <your licence> #----...
StarcoderdataPython
3393681
<filename>wordmarker/utils/yaml.py<gh_stars>1-10 import logging from wordmarker.utils import log class YamlUtils: """ :: yaml文件工具类 """ @log def __init__(self): pass def get_value(self, yaml_dict, prop_list, temp_prop, file_name): """ .. note:: 递归...
StarcoderdataPython
4805542
""" Reload SecB and fitted data and launch single GUI """ from pyhdx.fileIO import read_dynamx, txt_to_np from pyhdx import PeptideMasterTable import pickle import os from pyhdx.panel.apps import _single_app from pyhdx.panel.utils import reload_previous from pyhdx.panel.base import DEFAULT_COLORS, STATIC_DIR from pyhd...
StarcoderdataPython
38113
#!/usr/bin/env python import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings") import django django.setup() # your imports, e.g. Django models from buckets.models import * from buckets.name2date import name2date bucket = BucketInfo.objects.get(name='xinkaibuk1') allInDb = set() allInDb.update(I...
StarcoderdataPython
1731405
<gh_stars>10-100 import ml_collections def get_config() -> ml_collections.ConfigDict: config = ml_collections.ConfigDict() config.object_category = "Airplane" # ShapeNet Category config.in_memory = True # Flag: Use In-memory dataloader config.batch_size = 32 # Batch Size config.num_points = 102...
StarcoderdataPython
158985
<reponame>paulscottrobson/ukelele-trainer<gh_stars>0 # ********************************************************************************************************* # # Name: rhythmc.py # Purpose: Rhythm format compiler. # Author: <NAME> (<EMAIL>) # Date: 12 Nov 2016 (rewritten with new usage 23/11/16) # # *********...
StarcoderdataPython
3352538
# Desafio 036 -> Escreva um programa para aprovar o empréstimo bancário para # a compra de uma casa. O programa vai perguntar o valor da # casa, o salário do comprador e em quantos anos ele vai pagar. # Calcular o valor da prestação mensal, sabendo que ela não pode # ...
StarcoderdataPython
4836618
<reponame>LockOne/AFLplusplus-1 #!/usr/bin/python3 from copyreg import pickle from heapq import merge import os, glob import sys, shutil import subprocess as sp import carve_utils import datetime from multiprocessing import Process if len(sys.argv) != 5: print("usage : {} <.carved executable> <system_input_dir> <out...
StarcoderdataPython
110050
#!/usr/bin/env python # pipescaler/core/processor.py # # Copyright (C) 2020-2021 <NAME> # All rights reserved. # # This software may be modified and distributed under the terms of the # BSD license. from __future__ import annotations from abc import abstractmethod from argparse import ArgumentParser from ins...
StarcoderdataPython
101748
<reponame>RexSkywalkerLee/VRCNet<filename>models/.ipynb_checkpoints/ri-checkpoint.py import numpy as np import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data import torch.nn.functional as F from utils.model_utils import * class point_projection_feature(nn.Module): def __init__(self):...
StarcoderdataPython
1644235
#! python34 $this from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtGui import * import os, sys dirpath = os.path.dirname(os.path.abspath(__file__)) dirpath = os.path.dirname(dirpath) sys.path.insert(0,dirpath) isPython3 = sys.version_info[0]==3 if isPython3: unicode = str import yue from yu...
StarcoderdataPython
3264091
#!/usr/bin/env python # ################################################################################ # # Steam Headers Downloader # A script to download Steam header images # # ################################################################################ # # v0.1: 2015-04-29 # v0.1.1: 2015-04-30 # v0.1.2: 2...
StarcoderdataPython
1789095
import random from time import sleep major_chords = ['C', 'D', 'E', 'F', 'G', 'A', 'B'] minor_chords = ['Cm', 'Dm', 'Em', 'Fm', 'Gm', 'Am', 'Bm'] all_chords = major_chords + minor_chords strum_patterns = [' S-', ' Sand ', ' -and '] print('The strum pattern is') strum = '' for i in range(4): strum += random.choic...
StarcoderdataPython
3344120
<reponame>daniel-butler/full-stack-fastapi-postgresql<filename>{{cookiecutter.project_slug}}/backend/app/app/tests/utils/user.py import requests from app import crud from app.core import config from app.db.session import db_session from app.models.user import UserCreate from app.tests.utils.utils import random_lower_s...
StarcoderdataPython
3237758
<reponame>lendingblock/aio-kong from typing import List from .components import CrudComponent, JsonType class Snis(CrudComponent): """Kong SNI API component""" async def apply_json(self, data: JsonType, clear: bool = True) -> List: """Apply a JSON data objects for snis - never clear them""" ...
StarcoderdataPython
1737463
<reponame>mjcs-95/FreeCodeCamp_Scientific_Computing_with_Python import copy import random # Consider using the modules imported above. class Hat: def __init__(self,**kwargs): self.contents = [] for key, value in kwargs.items(): self.contents.extend([key] * value) def dr...
StarcoderdataPython
94781
<filename>abilities/__init__.py from .browse_the_web import browse_the_web, browser_for, waiting_browser_for __all__ = [ 'browse_the_web', 'browser_for', 'waiting_browser_for' # browse_the_web.py ]
StarcoderdataPython
4807865
my_list = ["192.168.0.5", 5060, "UP"] #create a list print("The first item in the list (IP): " + my_list[0] ) #Indexed still start at 0 print("The second item in the list (port): " + str(my_list[1]) ) #second item accessed at index 1 print("The last item in the list (state): " + my_list[2] ) #and so on #Challenge...
StarcoderdataPython
34797
def chess_knight(start, moves): def knight_can_move(from_pos, to_pos): return set(map(lambda x: abs(ord(x[0]) - ord(x[1])), zip(from_pos, to_pos))) == {1, 2} def knight_moves(pos): return {f + r for f in 'abcdefgh' for r in '12345678' if knight_can_move(pos, f + r)} # till ...
StarcoderdataPython
1683136
<gh_stars>1000+ # # Copyright (C) 2020 <NAME> and T5 Informatics GmbH # All Rights Reserved # # This file is part of the RDKit. # The contents are covered by the terms of the BSD license # which is included in the file license.txt, found at the root # of the RDKit source tree. # from rdkit import RDConfi...
StarcoderdataPython
3316369
<filename>basics/py/06_03_print_list.py # リスト # 数値 val_list = [0, 1, 2] # 全てを出力 print(val_list) # 要素を出力 print(val_list[2]) # 文字列 str_list = ['zero', 'one', 'two'] # 全てを出力 print(str_list) # 要素を出力 print(str_list[1])
StarcoderdataPython
1753150
<filename>src/advertising/googleads/src/automation/AutomationAdGroup.py from typing import Union from googleads import AdWordsClient from time import sleep from pymongo.collection import Collection as MongoCollection from src.Config import Config from src.Globals import ADWORDS_MICRO_AMOUNT_VALUE from src.advertising.g...
StarcoderdataPython
40342
<filename>main/migrations/0017_auto_20200608_1908.py # -*- coding: utf-8 -*- # Generated by Django 1.11 on 2020-06-08 16:08 from __future__ import unicode_literals import datetime from django.db import migrations, models import django.utils.timezone from django.utils.timezone import utc class Migration(migrations.Mi...
StarcoderdataPython
1701967
<filename>dataset/preparation/preparedata_train.py import os import sys import subprocess from joblib import Parallel, delayed import numpy as np import imageio imageio.plugins.freeimage.download() from imageio.plugins import freeimage import h5py from lz4.block import decompress import scipy.misc import cv2 from pat...
StarcoderdataPython
4840445
from cyder.cydns.validation import validate_domain_name, _name_type_check import cydns def name_to_domain(fqdn): """ This function doesn't throw an exception if nothing is found. """ from cyder.cydns.domain.models import Domain _name_type_check(fqdn) labels = fqdn.split('.') for i in xrang...
StarcoderdataPython
3279026
import torch import torch.nn as nn import torch.optim as optim from torchvision.utils import save_image from torch.utils.data import Dataset, DataLoader, TensorDataset from torchvision import transforms, datasets import tqdm class Generator(nn.Module): def __init__(self): super().__init__() self....
StarcoderdataPython
3216871
#!/usr/bin/env python """ Lester """ import interp __version__ = '0.0.0' #============================================================================= def main( argv ): """ Script execution entry point @param argv Arguments passed to the script @return Exit code (0 = success)...
StarcoderdataPython
51456
<gh_stars>0 # -*- coding: utf-8 -*- # # (C) Copyright 2022 Karellen, Inc. (https://www.karellen.co/) # # 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/LIC...
StarcoderdataPython
3390539
<gh_stars>10-100 from progressivis import Print from progressivis.io import CSVLoader from progressivis.stats import Min, Max from progressivis.datasets import get_dataset from progressivis.core import aio from . import ProgressiveTest class TestDataflow(ProgressiveTest): def test_dataflow_0(self): sched...
StarcoderdataPython
1717161
<filename>saulscript/__init__.py<gh_stars>0 import exceptions import runtime from runtime import Context
StarcoderdataPython
1727139
<reponame>gigabackup/gigantum-client import tempfile from pathlib import Path import pytest import os os.environ['GITLIB_FS_BACKEND'] = 'filesystem-shim' from gtmcore.gitlib import GitFilesystemShimmed from gtmcore.gitlib.tests.git_interface_mixin import GitInterfaceMixin, get_backend, write_file from gtmcore.gitlib...
StarcoderdataPython
1709183
import sys sys.path.append("..") from webclient import * wc = WebClient("http://www.cnblogs.com/feeland/p/4415645.html") print(wc.getstring())
StarcoderdataPython
4812672
from ._version import get_versions __version__ = get_versions()['version'] del get_versions from .xomega import *
StarcoderdataPython
1716733
__all__ = ['RivetThread']
StarcoderdataPython
1740808
import os import six import numpy from chainerchem.dataset.indexers.numpy_tuple_dataset_feature_indexer import NumpyTupleDatasetFeatureIndexer # NOQA class NumpyTupleDataset(object): """Dataset of a tuple of datasets. It combines multiple datasets into one dataset. Each example is represented by a tu...
StarcoderdataPython
36144
<gh_stars>1-10 def read_file(filepath): with open(filepath,'r') as i: inst = [int(x) for x in i.read().replace(')','-1,').replace('(','1,').strip('\n').strip(',').split(',')] return inst def calculate(inst,floor=0): for i,f in enumerate(inst): floor += f if floor < 0: brea...
StarcoderdataPython
99912
latam_countries = """Argentina Bolivia Brazil Chile Colombia Ecuador French Guiana Guyana Paraguay Peru Suriname Uruguay Venezuela Belize Costa Rica El Salvador Guatemala Honduras Mexico Nicaragua Panama Antigua & Barbuda Aruba Bahamas Barbados Cayman Islands Cuba Dominica Dominican Republic Grenada Guadeloupe Haiti Ja...
StarcoderdataPython
1666624
# -*- coding: cp1252 -*- from pylab import * from matplotlib.pyplot import * from numpy import * import os.path as osp DIR_NAME = osp.dirname(osp.abspath(__file__)) def get_freqs_data(filename, Trace=1, unit='MHz', dirname=None): if unit == 'Hz': fact = 1 elif unit == 'kHz': fact =...
StarcoderdataPython
158612
<gh_stars>1-10 import sys, json, os top_folder = sys.argv[1] output_folder = sys.argv[2] extension = ".json" desired_rank = "genus" taboos = ["uncultured_bacterium", "bacterium_enrichment_culture"] for (head, dirs, files) in os.walk(top_folder): for file in files: if file.endswith(extension): ...
StarcoderdataPython
53475
# -*- coding: utf-8 -*- """Helper to deal with querystring parameters according to jsonapi specification""" import json from flask import current_app from flapison.exceptions import ( BadRequest, InvalidFilters, InvalidSort, InvalidField, InvalidInclude, ) from flapison.schema import get_model_f...
StarcoderdataPython
176653
<gh_stars>0 # (C) Datadog, Inc. 2018-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) from codecs import open # To use a consistent encoding from os import path from setuptools import setup HERE = path.abspath(path.dirname(__file__)) ABOUT = {} with open(path.join(HERE, "dat...
StarcoderdataPython
3393363
<gh_stars>1-10 #!/usr/bin/env python3 """ Masking to have nucleotides NOT composed of the wanted factor """ from Bio import SeqIO from Bio.SeqRecord import SeqRecord from Bio.Seq import Seq import sys import os import numpy as np import math import itertools import os.path __author__ = "<NAME>" __copyright__ = "Copyr...
StarcoderdataPython
1760790
<filename>data/external/repositories_2to3/70362/kaggle-galaxies-master/convert_training_labels_to_npy.py<gh_stars>0 # TRAIN_LABELS_PATH = "data/raw/solutions_training.csv" TRAIN_LABELS_PATH = "data/raw/training_solutions_rev1.csv" TARGET_PATH = "data/solutions_train.npy" import pandas as pd import numpy as np ...
StarcoderdataPython
3237186
<reponame>dprokic/cars<gh_stars>0 # -*- coding: utf-8 -*- import scrapy class PolovniautomobiliSpider(scrapy.Spider): name = 'polovniautomobili' allowed_domains = ['www.polovniautomobili.com'] start_urls = ['https://www.polovniautomobili.com/putnicka-vozila/poslednja24h'] def parse(self, response): ...
StarcoderdataPython
145795
<reponame>int32bit/ceph-deploy import argparse import json import logging import sys import time from textwrap import dedent from ceph_deploy import conf, exc, hosts from ceph_deploy.util import system, packages from ceph_deploy.cliutil import priority from ceph_deploy.lib import remoto LOG = logging.getLogger(__nam...
StarcoderdataPython
23208
counter_name = 'I0_PIN' Size = wx.Size(1007, 726) logfile = '/net/helix/data/anfinrud_1502/Logfiles/I0_PIN-2.log' average_count = 1 max_value = 11 min_value = 0 start_fraction = 0.401 reject_outliers = False outlier_cutoff = 2.5 show_statistics = True time_window = 172800
StarcoderdataPython
1786823
#!/usr/bin/env python3 import csv import sys import requests from bs4 import BeautifulSoup import pdb def main(): fieldnames = ["recipient", "purpose", "term", "amount"] writer = csv.DictWriter(sys.stdout, fieldnames=fieldnames) writer.writeheader() url_pat = "https://www.arnoldventures.org/grants/p...
StarcoderdataPython
4821722
<reponame>kmakeev/RLs import Nn import numpy as np import tensorflow as tf import tensorflow_probability as tfp from Algorithms.tf2algos.base.off_policy import Off_Policy from utils.expl_expt import ExplorationExploitationClass class MAXSQN(Off_Policy): ''' https://github.com/createamind/DRL/blob/master/spinu...
StarcoderdataPython
40665
import os import re import warnings from uuid import uuid4, UUID import shapely.geometry import geopandas as gpd import pandas as pd import numpy as np from geojson import LineString, Point, Polygon, Feature, FeatureCollection, MultiPolygon try: import simplejson as json except ImportError: import json from ...
StarcoderdataPython
3372912
<reponame>VoVAllen/vovp<gh_stars>1-10 # -*- coding: utf-8 -*- import vovp import torch as th import multiprocessing as mp def subprocess_client(queue): import vovp, logging import torch as th try: results = [] client = vovp.init_client("/tmp/dgl_socket") ret_sub = client.get_te...
StarcoderdataPython
1641502
<reponame>varikakasandor/dissertation-balls-into-bins from k_choice.graphical.two_choice.full_knowledge.RL.DQN.constants import * from k_choice.graphical.two_choice.full_knowledge.dp import find_best_strategy from k_choice.graphical.two_choice.strategies.strategy_base import StrategyBase class DPStrategy(StrategyBase...
StarcoderdataPython
1687179
from django.http import HttpResponse from django.template.context_processors import csrf from django.shortcuts import render_to_response, redirect from mc_queue.models import QueueItem from django.core.cache import cache import time QUEUE_KEY = "queue" def index(request): queue = cache.get(QUEUE_KEY) if not queue...
StarcoderdataPython
1756765
<filename>LeetCode/Python3/Geometry/892. Surface Area of 3D Shapes.py # On a N * N grid, we place some 1 * 1 * 1 cubes. # Each value v = grid[i][j] represents a tower of v cubes placed on top of grid cell (i, j). # Return the total surface area of the resulting shapes. # Example 1: # Input: [[2]] # Output: 10 # Examp...
StarcoderdataPython