id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
93071
<gh_stars>0 """Used to make pytest functions available globally""" # Copyright (c) 2020 zfit # # # def pytest_generate_tests(metafunc): # if metafunc.config.option.all_jit_levels: # # # We're going to duplicate these tests by parametrizing them, # # which requires that each test has a fixture to a...
StarcoderdataPython
14353
#!/usr/bin/env python ######################################### # Title: Rocksat Data Server Class # # Project: Rocksat # # Version: 1.0 # # Date: August, 2017 # # Author: <NAME>, KJ4QLP # # Comment: Initial Version # ########...
StarcoderdataPython
123391
<gh_stars>1-10 import pytest from PySide import QtCore from jukeboxcore.gui import filesysitemdata as fsitd from jukeboxcore.filesys import JB_File dr = QtCore.Qt.DisplayRole def test_tfi_element_data(taskfileinfo): assert fsitd.taskfileinfo_element_data(taskfileinfo, dr) == "Shot01" def test_tfi_task_data(t...
StarcoderdataPython
174763
# Generated by Django 4.0 on 2021-12-21 20:49 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('observe', '0009_alter_observinglocation_options'), ] operations = [ migrations.AlterField( model_name='observinglocation', ...
StarcoderdataPython
1746346
class NeuroLangException(Exception): """Base class for NeuroLang Exceptions""" pass class UnexpectedExpressionError(NeuroLangException): pass class NeuroLangNotImplementedError(NeuroLangException): pass class ForbiddenExpressionError(NeuroLangException): pass class ForbiddenDisjunctionError...
StarcoderdataPython
3253756
<filename>words/urls.py from django.urls import path from . import views from . import exercises urlpatterns = [ path('', views.index, name='index'), path('auth/signup/', views.SignUp.as_view(), name='signup'), path('create_words/', views.read_words, name='read'), path('new_words/', views.show_new_word...
StarcoderdataPython
1777130
<gh_stars>1-10 import os import PIL import PIL.Image import PIL.ExifTags import cv2 import numpy as np folders = ["Left of Sidewalk", "Right of Sidewalk", "Middle of Sidewalk"] def rotate(img_name): img = PIL.Image.open(img_name) if img is None: return exif = { PIL.ExifTags.TAGS[k]: ...
StarcoderdataPython
1762583
<filename>CNIC-X/util.py # -*- coding: utf-8 -*- import skimage.io import skimage.transform import ipdb import numpy as np def load_image(path): try: img=skimage.io.imread(path).astype(float) except: return None if img is None:return None if len(img.shape)<2:return None if len(img.shape)==4:return None if len...
StarcoderdataPython
8070
import logging from episodes import find_updates, db, count_all from logging import error as logi from flask import Flask, jsonify, request def create_app(config, debug=False, testing=False, config_overrides=None): app = Flask(__name__) app.config.from_object(config) app.config['JSON_AS_ASCII'] = False ...
StarcoderdataPython
3260196
import numpy as np import datetime, sys import scipy.io import pdb import os import cartopy.crs as ccrs import cartopy.feature as cfeature from shapely.geometry import Polygon,Point import scipy.interpolate import xarray as xr import matplotlib.pyplot as plt import utilities.hfr_util import pyproj from mat...
StarcoderdataPython
36429
"""Defines the application configuration for the product application""" from __future__ import unicode_literals from django.apps import AppConfig class ProductConfig(AppConfig): """Configuration for the product application""" name = 'product' label = 'product' verbose_name = 'Product' def ready(...
StarcoderdataPython
1626447
<reponame>HustCoderHu/tensoflow_intro_practice import shutil as sh from os.path import join as pj import os.path as path import os import json from pprint import pprint from concurrent.futures import ProcessPoolExecutor import var_config as cf videoRoot = cf.videoRoot cwd = cf.cwd newVideoRoot = pj(cwd, 'all_data') ...
StarcoderdataPython
1649990
# -*- encoding: utf-8 -*- # Testing new amara.tree API # Testing quick reference examples import unittest import cStringIO import amara from amara.lib import testsupport from amara import tree, xml_print from amara import bindery XML = '<a x="1"><b>i</b><c>j<d/>k</c><b>l</b></a>' #self.assertEqual(doc[u'a'], doc.xml...
StarcoderdataPython
1704426
<filename>icc.modelstudio/src/icc/modelstudio/__init__.py # Example package with a console entry point from __future__ import print_function def main(*args, **kwargs): from isu.gui.gtk import main main(*args, **kwargs)
StarcoderdataPython
3385086
<reponame>michuschenk/accelerator from typing import Tuple import numpy as np from .base import BaseElement from .utils import bent_element class Dipole(BaseElement): """Dipole element""" def __init__(self, rho: float, theta: float): """Dipole element. Args: rho: bending radius...
StarcoderdataPython
1704160
import discord from discord.ext import commands from wwbot.util import fetch_guild, chunks from wwbot.db import Player, Poll, PollMessage from wwbot.permissions import is_participant from wwbot import errors def get_all_alive(bot): guild = fetch_guild(bot) alive = [] for p in Player.select(): m = ...
StarcoderdataPython
3322431
<reponame>IgorQueiroz32/curso_meigaron_pyhton_ao_ds<filename>House Rocket Company/main.py # ---------------------------------------- # Libraries # --------------------------------------- import pandas as pd import numpy as np from geopy.geocoders import Nominatim import ipywidgets as widgets from ipywidgets im...
StarcoderdataPython
59069
#!/usr/bin/env python import argparse, sys, math # covalent radius to decide a bond. bond length: r1+r2 radius = {" H": 0.25, " N": 0.65, " C": 0.70, " O": 0.60, " P": 1.00, " S": 1.00, "NA": 1.80, "CL": 1.00 } elebd_radius = {" N": 1.5,...
StarcoderdataPython
3225246
<reponame>saisankargochhayat/doot from tornado import websocket, web, ioloop import os path=os.getcwd() path=path.strip('Lettertrainer') + 'ML' import sys sys.path.append(path) import tornado.escape from tornado import gen import tornado.httpserver import tornado.options from sklearn.neighbors import KNeighborsClassifi...
StarcoderdataPython
3286075
from django.shortcuts import render, get_object_or_404, redirect from .models import User, Vehicle from django.views.generic.edit import CreateView, UpdateView, DeleteView from django.views.generic import ListView from .forms import VehicleForm, OwnerForm def get_owner_by_id(request, owner_id): owners = [get_obje...
StarcoderdataPython
184174
from test_plus.test import TestCase from referrals import utils from uuid import uuid4 class TestValidateUUID4(TestCase): def setUp(self): self.valid_uuid = str(uuid4()) self.invalid_uuid = 'FAKE_STRING' def test_with_valid_uuid4(self): self.assertTrue(utils.validate_uuid4(self.val...
StarcoderdataPython
3275016
# preprocess.data.loaders # Dataset loading utilities and primary API to the datasets module. # # Author: <NAME> # Created: Thu Apr 12 7:23:25 2020 -0400 # # Copyright (C) 2020 BSD 3-Clause License # For license information, see LICENSE.txt # # ID: loaders.py [] <EMAIL> $ """ Dataset loading utilities and primary AP...
StarcoderdataPython
156389
<gh_stars>0 from .urls import urlpatterns from .middleware import AfterRequestMiddleware
StarcoderdataPython
1678084
<reponame>SimonBoothroyd/nonbonded import os from typing import List, Type, Union import click from nonbonded.cli.utilities import generate_click_command from nonbonded.library.models.projects import Benchmark, Optimization from nonbonded.library.models.results import BenchmarkResult, OptimizationResult def _upload...
StarcoderdataPython
3289539
# ================================================================= # # Authors: <NAME> <<EMAIL>> # # Copyright (c) 2014 <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 # res...
StarcoderdataPython
8913
<reponame>Sette/autokeras import functools import pickle import kerastuner import tensorflow as tf from tensorflow.python.util import nest from autokeras.hypermodel import base from autokeras.hypermodel import compiler class Graph(kerastuner.engine.stateful.Stateful): """A graph consists of connected Blocks, Hy...
StarcoderdataPython
3217417
<gh_stars>10-100 from leapp.actors import Actor from leapp.models import NetworkManagerConfig from leapp.tags import ApplicationsPhaseTag, IPUWorkflowTag snippet_path = '/usr/lib/NetworkManager/conf.d/10-dhcp-dhclient.conf' snippet_data = ("# Generated by leapp when upgrading from RHEL7 to RHEL8\n" "[...
StarcoderdataPython
1674516
#!/usr/bin/env python # # __COPYRIGHT__ # # 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 rights to use, copy, modify, merge, publish, ...
StarcoderdataPython
1743106
<gh_stars>0 """ Django settings for {{cookiecutter.project_name}} project. Generated by 'django-admin startproject' using Django 2.0.2. For more information on this file, see https://docs.djangoproject.com/en/2.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2...
StarcoderdataPython
1786062
<reponame>sebnil/internet-uptime import time import urllib.request from datetime import date def internet_on(): try: urllib.request.urlopen('http://google.se', timeout=5) return 1 except urllib.request.URLError: print('URLError') except: print('could not do urlopen') ret...
StarcoderdataPython
52091
<gh_stars>10-100 from dataclasses import dataclass from typing import Callable, List, Optional from hooqu.analyzers.analyzer import (AggDefinition, DoubledValuedState, StandardScanShareableAnalyzer) from hooqu.analyzers.preconditions import has_column, is_numeric from hooqu.datafr...
StarcoderdataPython
1692225
import torch id_to_char = {} char_to_id = {} def _update_vocab(txt): chars = list(txt) for i, char in enumerate(chars): if char not in char_to_id: tmp_id = len(char_to_id) char_to_id[char] = tmp_id id_to_char[tmp_id] = char def load_text(file_name, use_dict=Fals...
StarcoderdataPython
3264433
<gh_stars>10-100 # coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. impor...
StarcoderdataPython
1688323
""" Python model "Population.py" Translated using PySD version 0.9.0 """ from __future__ import division import numpy as np from pysd import utils import xarray as xr from pysd.py_backend.functions import cache from pysd.py_backend import functions _subscript_dict = {} _namespace = { 'TIME': 'time', 'Time': ...
StarcoderdataPython
3252530
#!/usr/bin/env python """ Author: <NAME> Last Updated: 2015-03-13 This is a demo of Panda's occluder-culling system. It demonstrates loading occluder from an EGG file and adding them to a CullTraverser. """ # Load PRC data from panda3d.core import loadPrcFileData loadPrcFileData('', 'window-title Occluder Demo') loa...
StarcoderdataPython
1725935
<filename>ztfin2p3/metadata.py<gh_stars>0 """ Handling metadata """ import os import numpy as np import pandas import warnings from .utils.tools import parse_singledate def get_rawmeta(which, date, ccdid=None, fid=None, getwhat='metadata', **kwargs): """ which: [string] ...
StarcoderdataPython
4836746
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings class Migration(migrations.Migration): dependencies = [ ('editorial', '0078_auto_20171218_1301'), ] operations = [ migrations.CreateModel( ...
StarcoderdataPython
3273588
<gh_stars>1-10 """ Author: <REPLACE> Project: 100DaysPython File: module3_day35_taskScheduler.py Creation Date: <REPLACE> Description: <REPLACE> """ import subprocess import sys import time python_path = "/Users/sbeal603/.virtualenvs/100DaysPython/bin/python" subproces...
StarcoderdataPython
3266002
import torch.nn as nn # nn.Module을 상속받는다. class LeNet5(nn.Module): def __init__(self, classes=10): # 다중 상속 중복 문제 해결 super(LeNet5, self).__init__() # 1x32x32 -> 6x28x28 self.conv1 = nn.Conv2d(in_channels=1, out_channels=6, ...
StarcoderdataPython
95110
<reponame>data61/anonlink-client<filename>docs/tutorial/util.py """This module provides some helper functions for tutorial Notebooks.""" import anonlink from collections import defaultdict def solve(encodings, rec_to_blocks, threshold: float = 0.8): """ entity resolution, baby calls anonlink to do the heavy...
StarcoderdataPython
1714028
from distutils.core import setup setup( name = 'json_stable_stringify_python', packages = ['json_stable_stringify_python'], version = '0.2', description = 'Deterministic JSON stringify', author = '<NAME>', author_email = '<EMAIL>', url = 'https://github.com/haochi/json-stable-stringify-python', download...
StarcoderdataPython
1662797
""" Scripts concerned with processing raw data into objects ready for analysis. Many of these can be run as semi-automated services. """
StarcoderdataPython
137445
<gh_stars>1-10 # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals import numpy as np import collections UNKNOWN = np.nan R = 1 FR = 2 F = 3 FL = 4 L = 5 BL = 6 B = 7 BR = 8 U = 9 UF = 10 UB = 11 UL = 12 UR = 13 UFL = 14 UFR = 15 UBL = 16 UBR = 17 D = 18 DF = 19...
StarcoderdataPython
185095
<reponame>ryanzhao2/grade11cs """ def generate_list_books(filename): book_list = [] file_in = open(filename, encoding='utf-8', errors='replace') file_in.readline() for line in file_in: line = line.strip().split(",") line[2] = float(line[2]) line[3] = int(line[3]) line...
StarcoderdataPython
1747036
################################################################################ # # # Advection of Passive Scalars in 1D # # ...
StarcoderdataPython
1687487
<reponame>Rigborn4/PyMdlxConverter from PyMdlxConverter.common.binarystream import BinaryStream from PyMdlxConverter.parsers.mdlx.tokenstream import TokenStream from PyMdlxConverter.parsers.mdlx.genericobject import GenericObject from PyMdlxConverter.parsers.errors import TokenStreamError class ParticleEmitterPopcorn...
StarcoderdataPython
187776
<reponame>chigur/pose from . import Module as SoundNet
StarcoderdataPython
183629
# Derived from code found at: # https://github.com/laserson/dsq # Copyright 2013 Cloudera 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/LICEN...
StarcoderdataPython
98602
#!/usr/bin/env python import mirheo as mir import argparse import numpy as np ranks = (1, 1, 1) domain = (8, 8, 8) dt = 0.01 u = mir.Mirheo(ranks, domain, dt, debug_level=3, log_filename='log', no_splash=True) n = 20 np.random.seed(42) positions = np.random.rand(n, 3) velocities = np.random.rand(n, 3) - 0.5 for...
StarcoderdataPython
65348
from app.encryption import CryptoSigner signer = CryptoSigner() def test_should_sign_content(notify_api): signer.init_app(notify_api) assert signer.sign("this") != "this" def test_should_verify_content(notify_api): signer.init_app(notify_api) signed = signer.sign("this") assert signer.verify(si...
StarcoderdataPython
3356547
import base64 import os import psycopg2 import base64 from io import BytesIO from PIL import Image import sys sys.path.append(os.path.join(os.path.dirname(__file__), '..')) import settings # PATH読み込み top = settings.top script = settings.script image = settings.image #DB接続用ステータス設定 path = "localhost" port = "5432" dbna...
StarcoderdataPython
91890
<reponame>qagustina/python-exercises # -*- coding: utf-8 -*- """ Created on Tue Oct 5 16:32:23 2021 @author: qagustina """ # Ejercicio 8.10 import pandas as pd df = pd.read_csv('../Data/OBS_SHN_SF-BA.csv', index_col=['Time'], parse_dates=True) # COPIA dh = df['12-25-2014':].copy() delta_t = -1 # tiempo que tarda ...
StarcoderdataPython
107637
<filename>challenges/codility/lessons/q012/passing_cars_test.py #!/usr/bin/env python3 import random import unittest import numpy as np from challenges.codility.lessons.q012.passing_cars_v001 import * MAX_N = 100000 class PassingCarsTestCase(unittest.TestCase): def test_description_examples(self): self.ass...
StarcoderdataPython
4825270
__________________________________________________________________________________________________ sample 36 ms submission class Solution: def merge(self, intervals: List[List[int]]) -> List[List[int]]: sort_list = sorted(intervals) merged = [] for i in sort_list: ...
StarcoderdataPython
64599
<gh_stars>1-10 # Copyright (c) 2014, Facebook, Inc. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. from __future__ ...
StarcoderdataPython
3223241
<filename>seriesplugin/src/Identifiers/WunschlisteFeed.py # -*- coding: utf-8 -*- # by betonme @2012 # Imports import re from Components.config import config from Tools.BoundFunction import boundFunction from urllib import urlencode from datetime import datetime from sys import maxint # Internal from Plugins.Ex...
StarcoderdataPython
112667
<reponame>llewyn-jh/basic-deep-learning """Recurrent Neural Network.""" import tensorflow as tf import numpy as np class RecurrentNetwork: """A network is made up varialbles initialize, forward, backward, train, fit, calcualte validation loss, activation, dataset batch, predict, accuracy methods."""...
StarcoderdataPython
1649077
from django.urls import path, include from django.conf import settings from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.conf.urls.static import static urlpatterns = [ path('api/', include('api.urls')) ] if settings.DEBUG: urlpatterns += staticfiles_urlpatterns() # urlpattern...
StarcoderdataPython
1661146
<reponame>stevenkfirth/crossproduct<filename>crossproduct/segment.py # -*- coding: utf-8 -*- from .point import Point, Point2D from .points import Points from .line import Line2D, Line3D from .segments import Segments SMALL_NUM=0.00000001 class Segment(): "A n-D segment" classname='Segment' de...
StarcoderdataPython
144010
<gh_stars>1-10 import numpy as np class Deriv: """ Calculate the derivative with given order of the function f(t) at point t. """ def __init__(self, f, dt, o=1): """ Initialize the differentiation solver. Params: - f the name of the function object ('def f(t...
StarcoderdataPython
3361199
import math from kivy.graphics import * from kivy.properties import * from kivy.event import * from kivy.uix.textinput import TextInput from kivy.uix.label import Label from entity import Entity from kivy.clock import Clock import time name = 'tree' icon='tree1.png' class Tree(Entity): def __init__(self,canvas,pos)...
StarcoderdataPython
131100
<reponame>ericbrasiln/QualCoder<gh_stars>100-1000 # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ui_dialog_view_image.ui' # # Created by: PyQt5 UI code generator 5.14.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog...
StarcoderdataPython
3301959
<reponame>djw1149/pynmsg #!/usr/bin/env python # Copyright (c) 2009-2014 by Farsight Security, 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/LICE...
StarcoderdataPython
3383200
import pypyodbc import click import os import sys from collections import namedtuple ConnectionInfo = namedtuple('ConnectionInfo', 'server user password') BootstrapInfo = namedtuple('BootstrapTuple', 'database user password') Constants = namedtuple('Constants', 'host instance') constants = Constants('localhost', '(def...
StarcoderdataPython
3364932
from wordasso.wordasso import syn_words, pho_words, ent_words import csv files = ["../datasets/mc.csv"] def test_syn_words(): for f in files: with open(f, "r") as inf: reader = csv.reader(inf, delimiter=",") for row in reader: w = row[0] print("wor...
StarcoderdataPython
1645413
from os import listdir from pathlib import Path from typing import Optional, List import hydra import wandb from omegaconf import DictConfig from pytorch_lightning import LightningDataModule, LightningModule from pytorch_lightning.loggers import LightningLoggerBase, WandbLogger from tqdm import tqdm import numpy as np...
StarcoderdataPython
1707484
<reponame>shreejitverma/GeeksforGeeks '''https://www.geeksforgeeks.org/reverse-a-linked-list/ Given pointer to the head node of a linked list, the task is to reverse the linked list. We need to reverse the list by changing the links between nodes. Examples: Input: Head of following linked list 1->2->3->4->NULL Out...
StarcoderdataPython
159813
import sys sys.stderr.write("This is the stderr test\n") sys.stderr.flush() sys.stderr.write('this is my first sys tutorial\n') print (sys.argv) print datetime.datetime.now
StarcoderdataPython
1677198
<filename>accountit/invoices/admin.py<gh_stars>0 from django.contrib import admin from . import models admin.site.register(models.Invoice) admin.site.register(models.ItemSold)
StarcoderdataPython
198726
<filename>examples/mxnet/export.py #!/usr/bin/env python # -*- coding: utf-8 -*- from collections import namedtuple import chainer import chainer.links as L import numpy as np import mxnet as mx import onnx_chainer import onnx_mxnet chainer.config.train = False def save_as_onnx_then_import_from_mxnet(model, fn): ...
StarcoderdataPython
4805800
<reponame>naralakamsani/fake-face-detector import torch import predict_helper #Load the model from checkpoint model = predict_helper.load_checkpoint("checkpoint.pth") #Create a dummy input model.to('cpu') image = predict_helper.process_image("img4.jpg") dummy_input = image.unsqueeze_(0).to('cpu').float() ...
StarcoderdataPython
3293366
# # Copyright 2018 Analytics Zoo Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
StarcoderdataPython
149433
<reponame>DoRTaL94/edison<filename>edison/config.py import secrets import inspect import sys, inspect def get_config_object(env_keyword: str): """ Returns the the desired config class path. The function iterates through a dictionary returned by inspect. The dictionary contains details about all of th...
StarcoderdataPython
1666352
<gh_stars>0 class Solution: def removeDuplicates(self, nums: List[int]) -> int: k = len(nums) i=0 j=0 ct=1 while i<k-1 and ct<k: if nums[i] == nums[ct]: ct+=1 j+=1 else: nums[i+1] = nums[ct] ...
StarcoderdataPython
141277
from django.conf import settings from django.test import TestCase from nose.util import resolve_name __all__ = ('IP', 'PORT', 'SITE', 'DjangoTestCase') IP = getattr(settings, 'TDDSPRY_IP', '127.0.0.1') PORT = getattr(settings, 'TDDSPRY_PORT', 8088) SITE = 'http://%s:%s/' % (IP, PORT) DjangoTestCase = getattr(sett...
StarcoderdataPython
1708417
# Copyright (C) 2016-Present Pivotal Software, Inc. All rights reserved. # # This program and the accompanying materials are made available under # the terms of the 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 Li...
StarcoderdataPython
1620652
<gh_stars>0 #!/usr/bin/env python """ Pandoc filter to process code blocks with class "graphviz" into graphviz-generated images. """ import pygraphviz import hashlib import os import sys from pandocfilters import toJSONFilter, Str, Para, Image def sha1(x): return hashlib.sha1(x.encode(sys.getfilesystemencoding(...
StarcoderdataPython
23391
#!/usr/bin/python # -*- coding: UTF-8 -* from db.it.db_it_mgr import it_mgr __all__ = {"itSingleton"} class itSingleton(): def get_cmd_sql(self, sql): return it_mgr.get_cmd_sql(sql) it_singleton = itSingleton()
StarcoderdataPython
3293689
import json import requests import time url = 'https://api.warframestat.us/ps4/fissures' current_survivals = [] # hold current survivals until new once appear ids_sent = [] #execute every 5 sec while True: raw_data = requests.get(url) fissures_data = json.loads(raw_data.text) # I have to clear to get ...
StarcoderdataPython
173661
import os import unittest from docker.machine.cli.machine import Machine from docker.machine.errors import CLIError from docker.machine.cli.client import Status from docker.machine.constants import LOCALHOST digitalocean_access_token = os.environ.get('DOCKERMACHINEPY_DIGITALOCEAN_ACCESS_TOKEN') class BaseTestCases:...
StarcoderdataPython
1614929
<gh_stars>1-10 #coding: utf-8 ''' mbinary ####################################################################### # File : subarraySum.py # Author: mbinary # Mail: <EMAIL> # Blog: https://mbinary.xyz # Github: https://github.com/mbinary # Created Time: 2020-04-20 16:49 # Description: 子数组累加和 ###########################...
StarcoderdataPython
1659972
<reponame>tevin/RescueAirBnB<gh_stars>1-10 from flask import Flask, request, render_template, redirect from pymongo import MongoClient from envparse import env from flask_httpauth import HTTPDigestAuth import os.path # Get env vars stored either in an env file or on the machine def get_env(name): if (os.path.exists(...
StarcoderdataPython
3301914
<reponame>andrecp/myhdl_simple_uart<filename>baudrate_gen.py from myhdl import * def baudrate_gen(sysclk, reset_n, baud_rate_i, half_baud_rate_tick_o, baud_rate_tick_o): """ Serial This module implements a baudrate generator Ports: ----- sysclk: sysclk input reset_n: reset input baud_rate...
StarcoderdataPython
3350037
import ast from .scope import ScopeMixin def add_list_calls(node): """Provide context to Module and Function Def""" return ListCallTransformer().visit(node) def add_variable_context(node, trees): """Provide context to Module and Function Def""" return VariableTransformer(trees).visit(node) def add...
StarcoderdataPython
1621810
#!/usr/bin/python # -*- coding: utf-8 -*- import urllib import xbmc pluginid = "plugin.video.plexodusplayer" def main(): path = xbmc.getInfoLabel('ListItem.Path') stream_file = xbmc.getInfoLabel('ListItem.FileNameAndPath') if stream_file.endswith(".strm"): url = "plugin://{0}/tv/set_live_library_p...
StarcoderdataPython
191804
#!/usr/bin/python3 import httplib2 import os from apiclient import discovery import oauth2client from oauth2client import client from oauth2client import tools import json try: import argparse flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args() except ImportError: flags = None # acco...
StarcoderdataPython
3236882
# linear search def linear(srchlist, srch): """check every element, kinda slow""" for element in srchlist: if element == srch: return srchlist.index(element) return -1
StarcoderdataPython
187518
import lichtenberg from PIL import Image from pathlib import Path def main(): width = 200 height = 200 sim = lichtenberg.Simulator(width, height) sim.breakdown(60, 60) sim.insulate_circle(100, 100, 50) sim.simulate(max_loop=1000) image = Image.new('RGB', (width, height), (0x00, 0x00, 0x00...
StarcoderdataPython
3246830
<gh_stars>0 import numpy as np np.set_printoptions(precision=4) import time from scipy import spatial def xy2theta(x, y): if (x >= 0 and y >= 0): theta = 180/np.pi * np.arctan(y/x); if (x < 0 and y >= 0): theta = 180 - ((180/np.pi) * np.arctan(y/(-x))); if (x < 0 and y < 0): ...
StarcoderdataPython
1679500
<reponame>BA7JCM/angr<gh_stars>0 from typing import Tuple, Optional from ailment.expression import BinaryOp, Const, Expression, Convert from ailment.statement import Call from .base import PeepholeOptimizationExprBase class Bswap(PeepholeOptimizationExprBase): __slots__ = () NAME = "Simplifying bswap_16()"...
StarcoderdataPython
151916
<gh_stars>0 #!/usr/bin/env python3 import os import signal import time def sigusr1_handler(signum, frame): print(f'Catched a SIGUSR1 signal: {signum}, {frame}') def sigusr2_handler(signum, frame): print(f'Catched a SIGUSR2 signal: {signum}, {frame}') def main(): print(f'PID: {os.getpid()}') signal.s...
StarcoderdataPython
3266462
<gh_stars>1-10 class <caret>B(C): def __init__(self): C.__init__(self)
StarcoderdataPython
3385103
########################################################### # Module: phate_annotation.py # Programmer: <NAME> # # Description: Module containing classes and methods for representing annotation results from various sources # # Classes and methods: # annotationRecord # addPVOGid2list # getPVOGassoc...
StarcoderdataPython
3238909
from __future__ import absolute_import, division, print_function import re import inspect from cloudformation_validator.Profile import Profile from cfn_model.parser.ParserError import ParserError def lineno(): """Returns the current line number in our program.""" return str(' - ProfileLoader - line number: '+...
StarcoderdataPython
3361066
<gh_stars>0 import argparse from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * width = 500 height = 500 angle = 0.0 refreshMills = 15 points = [] polygons = [] window : GLint def myReshape(width, height): glViewport(0, 0, width, height) glMatrixMode(GL_PROJECTION) glLoadIdentity...
StarcoderdataPython
79463
<filename>openpype/hosts/nuke/api/__init__.py from .workio import ( file_extensions, has_unsaved_changes, save_file, open_file, current_file, work_root, ) from .command import ( reset_frame_range, get_handles, reset_resolution, viewer_update_and_undo_stop ) from .plugin import ...
StarcoderdataPython
3324221
"""Copyright (c) Facebook, Inc. and its affiliates.""" from typing import List, Optional import typer from rich.progress import track from rich.console import Console from pedroai.io import read_jsonlines, write_jsonlines from leaderboard.analysis.squad import SquadPredictionData from leaderboard.data import create_l...
StarcoderdataPython
1760931
<filename>venv/lib/python3.7/site-packages/diffoscope/feeders.py<gh_stars>0 # -*- coding: utf-8 -*- # # diffoscope: in-depth comparison of files, archives, and directories # # Copyright © 2014-2015 <NAME> <<EMAIL>> # # diffoscope is free software: you can redistribute it and/or modify # it under the terms of the GNU Ge...
StarcoderdataPython
32730
import datetime import remi import core.globals connected_clients = {} # Dict with key=session id of App Instance and value=ws_client.client_address of App Instance connected_clients['number'] = 0 # Special Dict Field for amount of active connections client_route_url_to...
StarcoderdataPython
4829932
""" Object id converter. This is taken from http://flask.pocoo.org/snippets/106/ """ from flask import Flask from werkzeug.routing import BaseConverter, ValidationError from itsdangerous import base64_encode, base64_decode from bson.objectid import ObjectId from bson.errors import InvalidId class ObjectIDConverter(B...
StarcoderdataPython