blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 3
288
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
112
| license_type
stringclasses 2
values | repo_name
stringlengths 5
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 684
values | visit_date
timestamp[us]date 2015-08-06 10:31:46
2023-09-06 10:44:38
| revision_date
timestamp[us]date 1970-01-01 02:38:32
2037-05-03 13:00:00
| committer_date
timestamp[us]date 1970-01-01 02:38:32
2023-09-06 01:08:06
| github_id
int64 4.92k
681M
โ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us]date 2012-06-04 01:52:49
2023-09-14 21:59:50
โ | gha_created_at
timestamp[us]date 2008-05-22 07:58:19
2023-08-21 12:35:19
โ | gha_language
stringclasses 147
values | src_encoding
stringclasses 25
values | language
stringclasses 1
value | is_vendor
bool 2
classes | is_generated
bool 2
classes | length_bytes
int64 128
12.7k
| extension
stringclasses 142
values | content
stringlengths 128
8.19k
| authors
listlengths 1
1
| author_id
stringlengths 1
132
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
36c01f762c49f4403f32c7ef8c027910a90c7932
|
2e927b6e4fbb4347f1753f80e9d43c7d01b9cba5
|
/Section 30 - File IO/file_stats.py
|
45669c705609fe90cbf3002134b9720195db5e94
|
[] |
no_license
|
tielushko/The-Modern-Python-3-Bootcamp
|
ec3d60d1f2e887d693efec1385a6dbcec4aa8b9a
|
17b3156f256275fdba204d514d914731f7038ea5
|
refs/heads/master
| 2023-01-22T01:04:31.918693
| 2020-12-04T02:41:29
| 2020-12-04T02:41:29
| 262,424,068
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 793
|
py
|
#write a function to count number of lines, words and characters in the text file
def statistics(file_name):
with open(file_name) as file:
statistics = {
'lines': 0,
'words': 0,
'characters': 0
}
for line in file:
#line = line.strip('\n')
words = line.split()
statistics['lines'] += 1
statistics['words'] += len(words)
statistics['characters'] += len(line)
return statistics
def statistics_v2(file_name):
with open(file_name) as file:
lines = file.readlines()
return { "lines": len(lines),
"words": sum(len(line.split(" ")) for line in lines),
"characters": sum(len(line) for line in lines) }
|
[
"tielushko@mail.usf.edu"
] |
tielushko@mail.usf.edu
|
c3b020f232c2731e008a9a413e7639d1e601bce5
|
406d2e9e3850a8ac7dcae302aefc5fb9ba40e2dd
|
/02.NetworkPrograming/multiconn-server.py
|
7c683543c62faec51e41af3333bc5ecc13df2e0d
|
[] |
no_license
|
jeonghaejun/02.Thread-NetworkPrograming-MQTT
|
565a0b72d98add71f1ff9a17998a03877ce8397a
|
4757d9813dbb555cb3bd3602a645f1315619d371
|
refs/heads/master
| 2023-04-01T18:08:57.927328
| 2021-04-05T18:02:34
| 2021-04-05T18:02:34
| 329,620,523
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,062
|
py
|
import socket
from _thread import *
def threaded(client_socket, addr):
print('Connected by :', addr[0], ':', addr[1])
while True:
try:
# ๋ฐ์ดํฐ๊ฐ ์์ ๋๋ฉด ํด๋ผ์ด์ธํธ์ ๋ค์ ์ ์กํฉ๋๋ค.(์์ฝ)
data = client_socket.recv(1024)
if not data:
print('Disconnected by '+addr[0], ':', addr[1])
break
print('Received from '+addr[0], ':', addr[1], data.decode())
client_socket.send(data)
except ConnectionResetError as e:
print('Disconnected by '+addr[0], ':', addr[1])
break
client_socket.close()
HOST = '127.0.0.1'
PORT = 9999
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server_socket.bind((HOST, PORT))
server_socket.listen()
print('server start')
while True:
print('wait')
client_socket, addr = server_socket.accept()
start_new_thread(threaded, (client_socket, addr))
server_socket.close()
|
[
"wjdgownsll@gmail.com"
] |
wjdgownsll@gmail.com
|
c3e9230912baf950221c94030dbce6778bb9e557
|
7137161629a1003583744cc3bd0e5d3498e0a924
|
/airflow/providers/amazon/aws/operators/glue.py
|
81d3468d592fdf9223937cf282e2a9faf3a40b54
|
[
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] |
permissive
|
jbampton/airflow
|
3fca85975854eb916f16143b659a9119af143963
|
dcfa14d60dade3fdefa001d10013466fe4d77f0d
|
refs/heads/master
| 2023-05-25T22:31:49.104069
| 2021-09-18T19:18:32
| 2021-09-18T19:18:32
| 247,645,744
| 3
| 0
|
Apache-2.0
| 2020-03-16T08:12:58
| 2020-03-16T08:12:57
| null |
UTF-8
|
Python
| false
| false
| 5,479
|
py
|
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import os.path
from typing import Optional
from airflow.models import BaseOperator
from airflow.providers.amazon.aws.hooks.glue import AwsGlueJobHook
from airflow.providers.amazon.aws.hooks.s3 import S3Hook
class AwsGlueJobOperator(BaseOperator):
"""
Creates an AWS Glue Job. AWS Glue is a serverless Spark
ETL service for running Spark Jobs on the AWS cloud.
Language support: Python and Scala
:param job_name: unique job name per AWS Account
:type job_name: Optional[str]
:param script_location: location of ETL script. Must be a local or S3 path
:type script_location: Optional[str]
:param job_desc: job description details
:type job_desc: Optional[str]
:param concurrent_run_limit: The maximum number of concurrent runs allowed for a job
:type concurrent_run_limit: Optional[int]
:param script_args: etl script arguments and AWS Glue arguments (templated)
:type script_args: dict
:param retry_limit: The maximum number of times to retry this job if it fails
:type retry_limit: Optional[int]
:param num_of_dpus: Number of AWS Glue DPUs to allocate to this Job.
:type num_of_dpus: int
:param region_name: aws region name (example: us-east-1)
:type region_name: str
:param s3_bucket: S3 bucket where logs and local etl script will be uploaded
:type s3_bucket: Optional[str]
:param iam_role_name: AWS IAM Role for Glue Job Execution
:type iam_role_name: Optional[str]
:param create_job_kwargs: Extra arguments for Glue Job Creation
:type create_job_kwargs: Optional[dict]
"""
template_fields = ('script_args',)
template_ext = ()
template_fields_renderers = {
"script_args": "json",
"create_job_kwargs": "json",
}
ui_color = '#ededed'
def __init__(
self,
*,
job_name: str = 'aws_glue_default_job',
job_desc: str = 'AWS Glue Job with Airflow',
script_location: Optional[str] = None,
concurrent_run_limit: Optional[int] = None,
script_args: Optional[dict] = None,
retry_limit: Optional[int] = None,
num_of_dpus: int = 6,
aws_conn_id: str = 'aws_default',
region_name: Optional[str] = None,
s3_bucket: Optional[str] = None,
iam_role_name: Optional[str] = None,
create_job_kwargs: Optional[dict] = None,
**kwargs,
):
super().__init__(**kwargs)
self.job_name = job_name
self.job_desc = job_desc
self.script_location = script_location
self.concurrent_run_limit = concurrent_run_limit or 1
self.script_args = script_args or {}
self.retry_limit = retry_limit
self.num_of_dpus = num_of_dpus
self.aws_conn_id = aws_conn_id
self.region_name = region_name
self.s3_bucket = s3_bucket
self.iam_role_name = iam_role_name
self.s3_protocol = "s3://"
self.s3_artifacts_prefix = 'artifacts/glue-scripts/'
self.create_job_kwargs = create_job_kwargs
def execute(self, context):
"""
Executes AWS Glue Job from Airflow
:return: the id of the current glue job.
"""
if self.script_location and not self.script_location.startswith(self.s3_protocol):
s3_hook = S3Hook(aws_conn_id=self.aws_conn_id)
script_name = os.path.basename(self.script_location)
s3_hook.load_file(
self.script_location, self.s3_artifacts_prefix + script_name, bucket_name=self.s3_bucket
)
s3_script_location = f"s3://{self.s3_bucket}/{self.s3_artifacts_prefix}{script_name}"
else:
s3_script_location = self.script_location
glue_job = AwsGlueJobHook(
job_name=self.job_name,
desc=self.job_desc,
concurrent_run_limit=self.concurrent_run_limit,
script_location=s3_script_location,
retry_limit=self.retry_limit,
num_of_dpus=self.num_of_dpus,
aws_conn_id=self.aws_conn_id,
region_name=self.region_name,
s3_bucket=self.s3_bucket,
iam_role_name=self.iam_role_name,
create_job_kwargs=self.create_job_kwargs,
)
self.log.info("Initializing AWS Glue Job: %s", self.job_name)
glue_job_run = glue_job.initialize_job(self.script_args)
glue_job_run = glue_job.job_completion(self.job_name, glue_job_run['JobRunId'])
self.log.info(
"AWS Glue Job: %s status: %s. Run Id: %s",
self.job_name,
glue_job_run['JobRunState'],
glue_job_run['JobRunId'],
)
return glue_job_run['JobRunId']
|
[
"noreply@github.com"
] |
jbampton.noreply@github.com
|
9babe7775b66eb37f494f78a5710eba7f275c9ef
|
fe5152ab8e656309f13bf29ededc4fe99ddfed45
|
/pyguymer3/geo/_area.py
|
5bab9ca971000a106ce9691521a219b45bb6845f
|
[
"Apache-2.0"
] |
permissive
|
Guymer/PyGuymer3
|
763ba7ee61e20ac5afb262d428de2d7499c07828
|
bc65f08f81ea0e76f5c9ae3d703056382f456f01
|
refs/heads/main
| 2023-08-23T14:42:34.997227
| 2023-08-19T08:39:54
| 2023-08-19T08:39:54
| 144,459,343
| 14
| 4
|
Apache-2.0
| 2023-08-13T07:47:29
| 2018-08-12T10:59:59
|
Python
|
UTF-8
|
Python
| false
| false
| 2,030
|
py
|
#!/usr/bin/env python3
# Define function ...
def _area(triangle, /, *, eps = 1.0e-12, nmax = 100):
"""Find the area of a triangle.
Parameters
----------
triangle : shapely.geometry.polygon.Polygon
the triangle
eps : float, optional
the tolerance of the Vincenty formula iterations
nmax : int, optional
the maximum number of the Vincenty formula iterations
Returns
-------
area : float
the area (in metres-squared)
Notes
-----
Copyright 2017 Thomas Guymer [1]_
References
----------
.. [1] PyGuymer3, https://github.com/Guymer/PyGuymer3
"""
# Import standard modules ...
import math
# Import sub-functions ...
from .calc_dist_between_two_locs import calc_dist_between_two_locs
# Find the distance from the second point to the first point, and the
# bearing of the first point as viewed from the second point ...
a, bearing1, _ = calc_dist_between_two_locs(
triangle.exterior.coords[1][0],
triangle.exterior.coords[1][1],
triangle.exterior.coords[0][0],
triangle.exterior.coords[0][1],
eps = eps,
nmax = nmax,
) # [m], [ยฐ]
# Find the distance from the second point to the third point, and the
# bearing of the third point as viewed from the second point ...
b, bearing2, _ = calc_dist_between_two_locs(
triangle.exterior.coords[1][0],
triangle.exterior.coords[1][1],
triangle.exterior.coords[2][0],
triangle.exterior.coords[2][1],
eps = eps,
nmax = nmax,
) # [m], [ยฐ]
# Use the two bearings to find the interior angle between the first and
# third points ...
C = (bearing2 - bearing1) % 180.0 # [ยฐ]
# Return answer ...
return 0.5 * a * b * math.sin(math.radians(C))
|
[
"t.m.guymer@thomasguymer.co.uk"
] |
t.m.guymer@thomasguymer.co.uk
|
3f69552aae3908907bfa9556c030f108c60f776a
|
15f347fce18db7e15b019fff66d58d27743143bd
|
/func_5.py
|
3b72ef73431279799af0ec7b0a0d703f6bdfb029
|
[] |
no_license
|
iamsubingyawali/PyAssignment
|
f716d51f3e49a0e05ac3452e54c401ed60bda8e9
|
8892770f411aa711db876b95ebe72d649c5fbdd2
|
refs/heads/master
| 2022-11-15T23:37:10.000820
| 2020-06-28T17:59:14
| 2020-06-28T17:59:14
| 275,639,784
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 317
|
py
|
def calc_factorial(num):
try:
if int(num) < 1:
return "Invalid Number"
else:
factorial = 1
for i in range(num, 0, -1):
factorial *= i
return factorial
except ValueError:
return "Invalid Number"
print(calc_factorial(6))
|
[
"="
] |
=
|
97961378b173b4085f3f840f06171a75831c05aa
|
98bd2625dbcc955deb007a07129cce8b9edb3c79
|
/plot_counts.py
|
fdbf25f52b8502d1743c8f5413fa547a21879c5b
|
[] |
no_license
|
melanieabrams/bremdata
|
70d0a374ab5dff32f6d9bbe0a3959a617a90ffa8
|
df7a12c72a29cca4760333445fafe55bb6e40247
|
refs/heads/master
| 2021-12-26T01:57:25.684288
| 2021-09-30T22:48:05
| 2021-09-30T22:48:05
| 166,273,567
| 0
| 3
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,593
|
py
|
import sys
import matplotlib.pyplot as plt
import pandas as pd
'''USAGE: python plot_counts.py outfilename.pdf {'Tn-seq' or 'Bar-Seq'} filename1 filename2...'''
#import
outfilename=sys.argv[1]
input_type=sys.argv[2]
countfiles=sys.argv[3:]
countfile_ids=[]
for countfile in countfiles:
countfile_ids.append(countfile.split('.')[0])
def get_BarSeq_counts(countfile):
counts = []
with open(countfile) as f:
lenF=0.0
for line in f:
lenF+=1
commsplit = line[2:-2].split(',')
for i in commsplit:
try:
n=float(i.split(': ')[1])
counts.append(normalized_n)
except:
None
f.close()
normalized_counts = []
for i in counts:
normalized_counts.append(n/lenF)
return normalized_counts
def get_TnSeq_counts(countfile):
counts = []
with open(countfile) as f:
lenF=0.0
for line in f:
lenF+=1
try:
n=float(line.split('\t')[5])
counts.append(n)
except:
None
f.close()
## normalized_counts = []
## for i in counts:
## normalized_counts.append(n/lenF)
#print(normalized_counts)
#return normalized_counts
return counts
def plot_counts(all_counts):
fig=plt.figure()
ax = fig.add_subplot(1,1,1)
ax.hist(all_counts, label=countfiles)
plt.title('skew')
# plt.xlabel('normalized abundance')
plt.xlabel('abundance')
plt.ylabel('number of inserts')
plt.legend()
plt.savefig(outfilename, bbox_inches='tight', format='pdf',dpi=1000)
def plot_low_counts(all_counts):
fig=plt.figure()
ax = fig.add_subplot(1,1,1)
ax.hist(all_counts, label=countfiles)
plt.title('skew')
# plt.xlabel('normalized abundance')
plt.xlabel('abundance')
plt.ylabel('number of inserts')
plt.xlim(0,1000)
plt.legend()
plt.savefig('lowcounts'+outfilename, bbox_inches='tight', format='pdf',dpi=1000)
def plot_all_counts():
all_counts=[]
if input_type=='Tn-Seq':
for countfile in countfiles:
all_counts.append(get_TnSeq_counts(countfile))
elif input_type=='Bar-Seq':
for countfile in countfiles:
all_counts.append(get_BarSeq_counts(countfile))
else:
print('specify Tn-Seq or Bar-Seq as sys.argv[1]')
plot_counts(all_counts)
plot_low_counts(all_counts)
plot_all_counts()
|
[
"noreply@github.com"
] |
melanieabrams.noreply@github.com
|
673109ab4c5461a308417ef12eb2f6cc623e7e98
|
9e988c0dfbea15cd23a3de860cb0c88c3dcdbd97
|
/sdBs/AllRun/o11_j195024+500900/sdB_o11_j195024+500900_coadd.py
|
aef310d98cb00bed20d9f11a4f45b62002dc5092
|
[] |
no_license
|
tboudreaux/SummerSTScICode
|
73b2e5839b10c0bf733808f4316d34be91c5a3bd
|
4dd1ffbb09e0a599257d21872f9d62b5420028b0
|
refs/heads/master
| 2021-01-20T18:07:44.723496
| 2016-08-08T16:49:53
| 2016-08-08T16:49:53
| 65,221,159
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 449
|
py
|
from gPhoton.gMap import gMap
def main():
gMap(band="NUV", skypos=[297.6,50.15], skyrange=[0.0333333333333,0.0333333333333], stepsz = 30., cntfile="/data2/fleming/GPHOTON_OUTPUT/LIGHTCURVES/sdBs/sdB_o11_j195024+500900/sdB_o11_j195024+500900_movie_count.fits", cntcoaddfile="/data2/fleming/GPHOTON_OUTPUT/LIGHTCURVES/sdB/sdB_o11_j195024+500900/sdB_o11_j195024+500900_count_coadd.fits", overwrite=True, verbose=3)
if __name__ == "__main__":
main()
|
[
"thomas@boudreauxmail.com"
] |
thomas@boudreauxmail.com
|
9a63309ab3eaecfd3e247064c688d8925f9239b2
|
971e0efcc68b8f7cfb1040c38008426f7bcf9d2e
|
/tests/artificial/transf_Difference/trend_MovingAverage/cycle_0/ar_12/test_artificial_1024_Difference_MovingAverage_0_12_0.py
|
b87dd9e926e0fdf59bad191e4236d882a4458a27
|
[
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
antoinecarme/pyaf
|
a105d172c2e7544f8d580d75f28b751351dd83b6
|
b12db77cb3fa9292e774b2b33db8ce732647c35e
|
refs/heads/master
| 2023-09-01T09:30:59.967219
| 2023-07-28T20:15:53
| 2023-07-28T20:15:53
| 70,790,978
| 457
| 77
|
BSD-3-Clause
| 2023-03-08T21:45:40
| 2016-10-13T09:30:30
|
Python
|
UTF-8
|
Python
| false
| false
| 270
|
py
|
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 0, transform = "Difference", sigma = 0.0, exog_count = 0, ar_order = 12);
|
[
"antoine.carme@laposte.net"
] |
antoine.carme@laposte.net
|
d4a8f2b08378b8ccd840b2cd6d84af62cf6968fb
|
319d66c48f51e3d98e9df953d406a6f545b72363
|
/Python/AppleAndOrange.py
|
947c089dc2e7012ae7350fe7be420b21641c8820
|
[
"Apache-2.0"
] |
permissive
|
WinrichSy/HackerRank-Solutions
|
291bc7a32dc4d9569d7028d6d665e86869fbf952
|
ed928de50cbbbdf0aee471630f6c04f9a0f69a1f
|
refs/heads/master
| 2022-07-18T15:43:48.865714
| 2020-05-16T00:21:56
| 2020-05-16T00:21:56
| 255,453,554
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 847
|
py
|
#Apple and Orange
#https://www.hackerrank.com/challenges/apple-and-orange/problem
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the countApplesAndOranges function below.
def countApplesAndOranges(s, t, a, b, apples, oranges):
apple_total = [1 for x in apples if (x+a)>=s and (x+a)<=t]
orange_total = [1 for x in oranges if (x+b)>=s and (x+b)<=t]
print(sum(apple_total))
print(sum(orange_total))
if __name__ == '__main__':
st = input().split()
s = int(st[0])
t = int(st[1])
ab = input().split()
a = int(ab[0])
b = int(ab[1])
mn = input().split()
m = int(mn[0])
n = int(mn[1])
apples = list(map(int, input().rstrip().split()))
oranges = list(map(int, input().rstrip().split()))
countApplesAndOranges(s, t, a, b, apples, oranges)
|
[
"winrichsy@gmail.com"
] |
winrichsy@gmail.com
|
94c4b1013a6ccaae658ddc243a83d00404d36642
|
aeb0a860196c7264bde3c02d51a350661520b6da
|
/HackerRank/Rank/medium/compress-string.py
|
6455fc819d304a53ed16030bbc114489436ddb16
|
[] |
no_license
|
Md-Hiccup/Problem-Solving
|
fc9078288c59ef74fc1170e773ac20d17c28fbbb
|
edbee71b69aeec0b1dbeed78f033852af698b844
|
refs/heads/master
| 2022-12-10T02:35:24.315807
| 2022-03-16T12:50:44
| 2022-03-16T12:50:44
| 199,393,332
| 0
| 2
| null | 2022-12-08T01:22:44
| 2019-07-29T06:37:12
|
Java
|
UTF-8
|
Python
| false
| false
| 648
|
py
|
"""
from itertools import groupby
# [k for k, g in groupby('AAAABBBCCDAABBB')] --> A B C D A B
# [list(g) for k, g in groupby('AAAABBBCCD')] --> AAAA BBB CC D
First, the character 1 occurs only once. It is replaced by (1, 1). Then the character 2 occurs three times, and it is replaced by (3, 2) and so on.
Sample Input
1222311
Sample Output
(1, 1) (3, 2) (1, 3) (2, 1)
"""
# Enter your code here. Read input from STDIN. Print output to STDOUT
from itertools import groupby
inp = input()
# Way 1
# for i,j in groupby(inp):
# print((len(list(j)), int(i)), end=' ')
# Way 2
print(*[(len(list(j)), int(i)) for i, j in groupby(inp)])
|
[
"ask2md@gmail.com"
] |
ask2md@gmail.com
|
f9e193313f7efcadc7d30522e7441224144c8203
|
f4c5acc4d8923fd04dfcccff986cfd41a55510d5
|
/MyGUI/views/helpers.py
|
4ee283b8778fdf9893b213543de740ca3d360017
|
[] |
no_license
|
InesIvanova/python-gui-layer-for-bash-commands
|
307d60d789d65fba62ff76c003d74c8c7efd3a9a
|
3a4047af46bd1599ab2b9db82449bf79b1a3b238
|
refs/heads/master
| 2023-03-18T03:07:35.687810
| 2021-03-07T22:51:23
| 2021-03-07T22:51:23
| 345,472,377
| 1
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 230
|
py
|
from tkinter import Tk
def destroy_view(func):
def wrapper(tk: Tk):
[slave.grid_forget() for slave in tk.grid_slaves()]
[slave.pack_forget() for slave in tk.pack_slaves()]
func(tk)
return wrapper
|
[
"ines.iv.ivanova@gmail.com"
] |
ines.iv.ivanova@gmail.com
|
f88fe23779ff393ccdfd5300828f4964e5b4c3b0
|
84b5ac79cb471cad1d54ed1d2c842dc5581a03f0
|
/branches/unstable/src/paella/kde/trait.py
|
b4c2a442e2b68c86579c1af9db573e2894c765e6
|
[] |
no_license
|
BackupTheBerlios/paella-svn
|
c8fb5ea3ae2a5e4ca6325a0b3623d80368b767f3
|
d737a5ea4b40f279a1b2742c62bc34bd7df68348
|
refs/heads/master
| 2021-01-18T14:07:40.881696
| 2012-11-13T20:33:08
| 2012-11-13T20:33:08
| 40,747,253
| 0
| 1
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 6,292
|
py
|
import os
import re
from qt import SLOT, SIGNAL, Qt
from qt import QSyntaxHighlighter
from qt import QColor, QWidget
from qt import QVBoxLayout, QHBoxLayout
from qt import QSplitter
from qtext import QextScintilla, QextScintillaLexer
from qtext import QextScintillaLexerPython
from kdeui import KMainWindow
from kdeui import KPopupMenu
from kdeui import KMessageBox, KTextEdit
from kdeui import KListView, KListViewItem
from kfile import KFileDialog
from paella.base.template import Template
from paella.profile.base import PaellaConfig
from paella.profile.base import PaellaConnection
from paella.profile.trait import Trait
from useless.db.midlevel import StatementCursor
from useless.kbase.gui import MainWindow, SimpleSplitWindow
from useless.kbase.gui import ViewWindow
from useless.kdb.gui import ViewBrowser
from useless.kdb.gui import RecordSelector
from paella.kde.base import RecordSelectorWindow
from paella.kde.xmlgen import TraitDoc, PackageDoc
from paella.kde.db.gui import dbwidget
#from paella.kde.differ import TraitList
from paella.kde.template import TemplateEditorWindow
from paella.kde.template import SimpleEdit
class AnotherView(QextScintilla):
def __init__(self, app, parent):
QextScintilla.__init__(self, parent)
self.app = app
self.pylex = QextScintillaLexerPython(self)
self.lex = QextScintillaLexer(self)
def setText(self, text):
line = text.split('\n')[0]
if 'python' in line:
self.setLexer(self.pylex)
else:
self.setLexer(self.lex)
QextScintilla.setText(self, text)
class PackageView(ViewBrowser):
def __init__(self, app, parent):
ViewBrowser.__init__(self, app, parent, PackageDoc)
class PackageSelector(RecordSelector):
def __init__(self, app, parent, suite):
table = '%s_packages' % suite
fields = ['package', 'priority', 'section', 'installedsize',
'maintainer', 'version', 'description']
idcol = 'package'
groupfields = ['priority', 'section', 'maintainer']
view = PackageView
RecordSelector.__init__(self, app, parent, table, fields,
idcol, groupfields, view, 'PackageSelector')
class PackageSelectorWindow(KMainWindow):
def __init__(self, app, parent, suite):
KMainWindow.__init__(self, parent, 'PackageSelector')
self.app = app
self.conn = app.conn
self.mainView = PackageSelector(self.app, self, suite)
self.mainView.recView.doc.set_suite(suite)
self.setCentralWidget(self.mainView)
self.show()
class TraitView(ViewBrowser):
def __init__(self, app, parent):
ViewBrowser.__init__(self, app, parent, TraitDoc)
def set_trait(self, trait):
self.doc.set_trait(trait)
self.setText(self.doc.toxml())
def set_suite(self, suite):
self.doc.suite = suite
self.doc.trait = Trait(self.app.conn, suite=suite)
def setSource(self, url):
action, context, id = str(url).split('.')
if action == 'show':
if context == 'parent':
win = TraitMainWindow(self.app, self.parent(), self.doc.suite)
win.view.set_trait(id)
elif context == 'template':
fid = id.replace(',', '.')
package, template = fid.split('...')
win = ViewWindow(self.app, self.parent(), SimpleEdit, 'TemplateView')
templatefile = self.doc.trait._templates.templatedata(package, template)
win.view.setText(templatefile)
win.resize(600, 800)
elif context == 'script':
scriptfile = self.doc.trait._scripts.scriptdata(id)
win = ViewWindow(self.app, self.parent(), SimpleEdit, 'ScriptView')
win.view.setText(scriptfile)
win.resize(600, 800)
else:
self._url_error(url)
elif action == 'edit':
if context == 'templates':
#win = KFileDialog('.', '*', self, 'hello file dialog', False)
#win.show()
win = TemplateEditorWindow(self.app, self.parent(), self.doc.suite)
elif context == 'packages':
win = PackageSelectorWindow(self.app, self.parent(), self.doc.suite)
else:
self._url_error(url)
else:
self._url_error(url)
class TraitMainWindow(SimpleSplitWindow):
def __init__(self, app, parent, suite):
SimpleSplitWindow.__init__(self, app, parent, TraitView, 'TraitMainWindow')
self.app = app
self.initActions()
self.initMenus()
self.initToolbar()
self.conn = app.conn
self.suite = suite
self.cfg = app.cfg
self.cursor = StatementCursor(self.conn)
self.trait = Trait(self.conn, suite=suite)
self.refreshListView()
self.view.set_suite(suite)
self.resize(600, 800)
self.setCaption('%s traits' % suite)
def initActions(self):
collection = self.actionCollection()
def initMenus(self):
mainMenu = KPopupMenu(self)
menus = [mainMenu]
self.menuBar().insertItem('&Main', mainMenu)
self.menuBar().insertItem('&Help', self.helpMenu(''))
def initToolbar(self):
toolbar = self.toolBar()
def initlistView(self):
self.listView.setRootIsDecorated(True)
self.listView.addColumn('group')
def refreshListView(self):
trait_folder = KListViewItem(self.listView, 'traits')
for trait in self.trait.get_trait_list():
item = KListViewItem(trait_folder, trait)
item.trait = trait
def selectionChanged(self):
current = self.listView.currentItem()
if hasattr(current, 'trait'):
print 'trait is', current.trait
self.view.set_trait(current.trait)
if hasattr(current, 'suite'):
print 'suite is', current.suite
if hasattr(current, 'widget'):
print 'widget is', current.widget
if __name__ == '__main__':
cfg = PaellaConfig()
conn = PaellaConnection(cfg)
t = Trait(conn, suite='kudzu')
|
[
"umeboshi@cfc4e7be-4be4-0310-bcfe-fc894edce94f"
] |
umeboshi@cfc4e7be-4be4-0310-bcfe-fc894edce94f
|
efdf79e368752ad93463e91fbb35da14ce8d73cc
|
61aa319732d3fa7912e28f5ff7768498f8dda005
|
/util/update_copyright/__init__.py
|
8046b58c3d0645928af9978505e51e9e8f5dc1e5
|
[
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license",
"LGPL-2.0-or-later",
"MIT"
] |
permissive
|
TeCSAR-UNCC/gem5-SALAM
|
37f2f7198c93b4c18452550df48c1a2ab14b14fb
|
c14c39235f4e376e64dc68b81bd2447e8a47ff65
|
refs/heads/main
| 2023-06-08T22:16:25.260792
| 2023-05-31T16:43:46
| 2023-05-31T16:43:46
| 154,335,724
| 62
| 22
|
BSD-3-Clause
| 2023-05-31T16:43:48
| 2018-10-23T13:45:44
|
C++
|
UTF-8
|
Python
| false
| false
| 3,766
|
py
|
# Copyright (c) 2020 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality of the software
# licensed hereunder. You may use the software subject to the license
# terms below provided that you ensure that this notice is replicated
# unmodified and in its entirety in all distributions of the software,
# modified or unmodified, in source code or in binary form.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer;
# redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
Utilities to parse and modify copyright headers in gem5 source.
"""
import re
org_alias_map = {
'arm': b'ARM Limited',
'uc': b'The Regents of the University of California',
}
_update_copyright_year_regexp = re.compile(b'(.*?)([0-9]+)$')
def _update_copyright_years(m, cur_year, org_bytes):
'''
Does e.g.: b'2016, 2018-2019' -> b'2016, 2018-2020'.
:param m: match containing only the years part of the string
:type m: re.Match
:param cur_year: the current year to update the copyright to
:type cur_year: int
:return: the new years part of the string
:rtype: bytes
'''
global _update_copyright_year_regexp
cur_year_bytes = str(cur_year).encode()
m = _update_copyright_year_regexp.match(m.group(1))
years_prefix = m.group(1)
old_year_bytes = m.group(2)
old_year = int(old_year_bytes.decode())
if old_year == cur_year:
new_years_string = old_year_bytes
elif old_year == cur_year - 1:
if len(years_prefix) > 0 and years_prefix[-1:] == b'-':
new_years_string = cur_year_bytes
else:
new_years_string = old_year_bytes + b'-' + cur_year_bytes
else:
new_years_string = old_year_bytes + b', ' + cur_year_bytes
new_years_string = years_prefix + new_years_string
return b' Copyright (c) %b %b\n' % (new_years_string, org_bytes)
def update_copyright(data, cur_year, org_bytes):
update_copyright_regexp = re.compile(
b' Copyright \\(c\\) ([0-9,\- ]+) ' + org_bytes + b'\n',
re.IGNORECASE
)
return update_copyright_regexp.sub(
lambda m: _update_copyright_years(m, cur_year, org_bytes),
data,
count=1,
)
|
[
"sroger48@uncc.edu"
] |
sroger48@uncc.edu
|
2f3f019f5fc52ecbcefb36671238ff9cf02a68be
|
883c475191edd39c1a36a0873fd2f460a07dbb59
|
/autocti/instruments/euclid/header.py
|
1279ec75bcd6013807c6d8e8fc504e40fc57d5e4
|
[
"MIT"
] |
permissive
|
Jammy2211/PyAutoCTI
|
c18f4bb373572be202d691cc6b1438211a2cd07b
|
32e9ec7194776e5f60329e674942bc19f8626b04
|
refs/heads/main
| 2023-08-16T10:59:09.723401
| 2023-08-14T09:42:57
| 2023-08-14T09:42:57
| 156,396,410
| 6
| 2
|
MIT
| 2023-09-03T20:03:43
| 2018-11-06T14:30:28
|
Python
|
UTF-8
|
Python
| false
| false
| 851
|
py
|
from typing import Dict, Tuple, Optional
from autoarray.structures.header import Header
class HeaderEuclid(Header):
def __init__(
self,
header_sci_obj: Dict = None,
header_hdu_obj: Dict = None,
original_roe_corner: Tuple[int, int] = None,
readout_offsets: Optional[Tuple] = None,
ccd_id: Optional[str] = None,
quadrant_id: Optional[str] = None,
):
super().__init__(
header_sci_obj=header_sci_obj,
header_hdu_obj=header_hdu_obj,
original_roe_corner=original_roe_corner,
readout_offsets=readout_offsets,
)
self.ccd_id = ccd_id
self.quadrant_id = quadrant_id
@property
def row_index(self) -> str:
if self.ccd_id is not None:
return self.ccd_id[-1]
|
[
"james.w.nightingale@durham.ac.uk"
] |
james.w.nightingale@durham.ac.uk
|
ac9b3edb41ce1ff5721302398091500bd8f0c622
|
568d7d17d09adeeffe54a1864cd896b13988960c
|
/project_blog/day02/ddblog/topic/models.py
|
4274cbdcd6bab4f10850dc3972fe2120c065ee05
|
[
"Apache-2.0"
] |
permissive
|
Amiao-miao/all-codes
|
e2d1971dfd4cecaaa291ddf710999f2fc4d8995f
|
ec50036d42d40086cac5fddf6baf4de18ac91e55
|
refs/heads/main
| 2023-02-24T10:36:27.414153
| 2021-02-01T10:51:55
| 2021-02-01T10:51:55
| 334,908,634
| 1
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 642
|
py
|
from django.db import models
from user.models import UserProfile
# Create your models here.
class Topic(models.Model):
title=models.CharField('ๆ็ซ ๆ ้ข',max_length=50)
#tec no-tec
category=models.CharField('ๆ็ซ ๅ็ฑป',max_length=20)
# public private
limit=models.CharField('ๆ็ซ ๆ้',max_length=20)
introduce=models.CharField('ๆ็ซ ็ฎไป',max_length=50)
content=models.TextField('ๆ็ซ ๅ
ๅฎน')
created_time=models.DateTimeField(auto_now_add=True)
updated_time=models.DateTimeField(auto_now=True)
# 1ๅฏนๅค็ๅค้ฎ
user_profile=models.ForeignKey(UserProfile,on_delete=models.CASCADE)
|
[
"895854566@qq.com"
] |
895854566@qq.com
|
6a46ff7662d9a86c93c34daca53e6021b8af5ce5
|
c43855664f500991da9c0bfb9872fb71dfcf77cf
|
/MxOnline_Django/apps/course/migrations/0007_course_tag.py
|
7a2ddcaaf39a99a7401d88d6ad23c5dcc410ec5d
|
[] |
no_license
|
zfh960126/first
|
a2bc128d16d99a0fc348773418f81654228cc6ff
|
cd51bcfbb8cdf83a21e5fd838f95c66abbec77bd
|
refs/heads/master
| 2021-04-03T01:21:32.822960
| 2018-05-24T23:56:40
| 2018-05-24T23:56:40
| 124,852,293
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 482
|
py
|
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2018-05-04 10:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('course', '0006_course_category'),
]
operations = [
migrations.AddField(
model_name='course',
name='tag',
field=models.CharField(default='', max_length=10, verbose_name='่ฏพ็จๆ ็ญพ'),
),
]
|
[
"you@example.com"
] |
you@example.com
|
d144360eebe72f84e535278b005e2ab15ab08397
|
c4bcb851c00d2830267b1997fa91d41e243b64c2
|
/utils/actions/smooth/binary.py
|
58550b7e2e8c58d232296cab4c3ca9aad97130b8
|
[] |
no_license
|
tjacek/cluster_images
|
5d6a41114a4039b3bdedc34d872be4e6db3ba066
|
8c660c69658c64c6b9de66d6faa41c92486c24c5
|
refs/heads/master
| 2021-01-23T21:01:17.078036
| 2018-06-07T14:33:50
| 2018-06-07T14:33:50
| 44,881,052
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 638
|
py
|
import sys,os
sys.path.append(os.path.abspath('../cluster_images'))
import numpy as np
import utils.actions.smooth
class BinarizeActions(utils.actions.smooth.TimeSeriesTransform):
def get_series_transform(self,frames):
frames=np.array(frames)
fr_std= np.std(frames,axis=0)
return Binarization(fr_std)
class Binarization(object):
def __init__(self,var):
self.var=var
def __call__(self,x):
def norm_helper(i,x_i):
if(self.var[i]==0):
return 0
return int((x_i)/self.var[i])
return [ norm_helper(i,x_i) for i,x_i in enumerate(x)]
|
[
"tjacek@student.agh.edu.pl"
] |
tjacek@student.agh.edu.pl
|
e02a62dfeb68a1076db30d166b57facbc45c7901
|
6fa7f99d3d3d9b177ef01ebf9a9da4982813b7d4
|
/hpJsoWBBHWKZ9NcAi_22.py
|
e06399915f4bab0bc7737e23679f04adb2ec0486
|
[] |
no_license
|
daniel-reich/ubiquitous-fiesta
|
26e80f0082f8589e51d359ce7953117a3da7d38c
|
9af2700dbe59284f5697e612491499841a6c126f
|
refs/heads/master
| 2023-04-05T06:40:37.328213
| 2021-04-06T20:17:44
| 2021-04-06T20:17:44
| 355,318,759
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 402
|
py
|
import re
def bird_code(lst):
l = []
for i in lst:
x = re.sub(r'\-',' ',i.upper()).split()
if len(x) == 1:
l.append(x[0][:4])
if len(x) == 2:
l.append(x[0][:2] + x[1][:2])
if len(x) == 3:
l.append(x[0][0] + x[1][0] + x[2][:2])
if len(x) == 4:
l.append(x[0][0] + x[1][0] + x[2][0] + x[3][0])
return l
|
[
"daniel.reich@danielreichs-MacBook-Pro.local"
] |
daniel.reich@danielreichs-MacBook-Pro.local
|
a46f19dfaa6990720d7398e822caaf69f0d8be00
|
f4b60f5e49baf60976987946c20a8ebca4880602
|
/lib/python2.7/site-packages/acimodel-1.3_2j-py2.7.egg/cobra/modelimpl/vns/rtmconnatt.py
|
28e7b5b6f4be518f824e5a5438863d03a68a0e9f
|
[] |
no_license
|
cqbomb/qytang_aci
|
12e508d54d9f774b537c33563762e694783d6ba8
|
a7fab9d6cda7fadcc995672e55c0ef7e7187696e
|
refs/heads/master
| 2022-12-21T13:30:05.240231
| 2018-12-04T01:46:53
| 2018-12-04T01:46:53
| 159,911,666
| 0
| 0
| null | 2022-12-07T23:53:02
| 2018-12-01T05:17:50
|
Python
|
UTF-8
|
Python
| false
| false
| 4,795
|
py
|
# coding=UTF-8
# **********************************************************************
# Copyright (c) 2013-2016 Cisco Systems, Inc. All rights reserved
# written by zen warriors, do not modify!
# **********************************************************************
from cobra.mit.meta import ClassMeta
from cobra.mit.meta import StatsClassMeta
from cobra.mit.meta import CounterMeta
from cobra.mit.meta import PropMeta
from cobra.mit.meta import Category
from cobra.mit.meta import SourceRelationMeta
from cobra.mit.meta import NamedSourceRelationMeta
from cobra.mit.meta import TargetRelationMeta
from cobra.mit.meta import DeploymentPathMeta, DeploymentCategory
from cobra.model.category import MoCategory, PropCategory, CounterCategory
from cobra.mit.mo import Mo
# ##################################################
class RtMConnAtt(Mo):
"""
A target relation to a connector between logical functions. Note that this relation is an internal object.
"""
meta = TargetRelationMeta("cobra.model.vns.RtMConnAtt", "cobra.model.vns.AbsFuncConn")
meta.moClassName = "vnsRtMConnAtt"
meta.rnFormat = "rtMConnAtt-[%(tDn)s]"
meta.category = MoCategory.RELATIONSHIP_FROM_LOCAL
meta.label = "Function Connector"
meta.writeAccessMask = 0x100000000001
meta.readAccessMask = 0x2000100000000001
meta.isDomainable = False
meta.isReadOnly = True
meta.isConfigurable = False
meta.isDeletable = False
meta.isContextRoot = False
meta.parentClasses.add("cobra.model.vns.MConn")
meta.superClasses.add("cobra.model.reln.From")
meta.superClasses.add("cobra.model.reln.Inst")
meta.rnPrefixes = [
('rtMConnAtt-', True),
]
prop = PropMeta("str", "childAction", "childAction", 4, PropCategory.CHILD_ACTION)
prop.label = "None"
prop.isImplicit = True
prop.isAdmin = True
prop._addConstant("deleteAll", "deleteall", 16384)
prop._addConstant("deleteNonPresent", "deletenonpresent", 8192)
prop._addConstant("ignore", "ignore", 4096)
meta.props.add("childAction", prop)
prop = PropMeta("str", "dn", "dn", 1, PropCategory.DN)
prop.label = "None"
prop.isDn = True
prop.isImplicit = True
prop.isAdmin = True
prop.isCreateOnly = True
meta.props.add("dn", prop)
prop = PropMeta("str", "lcOwn", "lcOwn", 9, PropCategory.REGULAR)
prop.label = "None"
prop.isImplicit = True
prop.isAdmin = True
prop.defaultValue = 0
prop.defaultValueStr = "local"
prop._addConstant("implicit", "implicit", 4)
prop._addConstant("local", "local", 0)
prop._addConstant("policy", "policy", 1)
prop._addConstant("replica", "replica", 2)
prop._addConstant("resolveOnBehalf", "resolvedonbehalf", 3)
meta.props.add("lcOwn", prop)
prop = PropMeta("str", "modTs", "modTs", 7, PropCategory.REGULAR)
prop.label = "None"
prop.isImplicit = True
prop.isAdmin = True
prop.defaultValue = 0
prop.defaultValueStr = "never"
prop._addConstant("never", "never", 0)
meta.props.add("modTs", prop)
prop = PropMeta("str", "rn", "rn", 2, PropCategory.RN)
prop.label = "None"
prop.isRn = True
prop.isImplicit = True
prop.isAdmin = True
prop.isCreateOnly = True
meta.props.add("rn", prop)
prop = PropMeta("str", "status", "status", 3, PropCategory.STATUS)
prop.label = "None"
prop.isImplicit = True
prop.isAdmin = True
prop._addConstant("created", "created", 2)
prop._addConstant("deleted", "deleted", 8)
prop._addConstant("modified", "modified", 4)
meta.props.add("status", prop)
prop = PropMeta("str", "tCl", "tCl", 13555, PropCategory.REGULAR)
prop.label = "Target-class"
prop.isImplicit = True
prop.isAdmin = True
prop.defaultValue = 4686
prop.defaultValueStr = "vnsAbsFuncConn"
prop._addConstant("unspecified", "unspecified", 0)
prop._addConstant("vnsAbsFuncConn", None, 4686)
meta.props.add("tCl", prop)
prop = PropMeta("str", "tDn", "tDn", 13554, PropCategory.REGULAR)
prop.label = "Target-dn"
prop.isConfig = True
prop.isAdmin = True
prop.isCreateOnly = True
prop.isNaming = True
meta.props.add("tDn", prop)
meta.namingProps.append(getattr(meta.props, "tDn"))
getattr(meta.props, "tDn").needDelimiter = True
# Deployment Meta
meta.deploymentQuery = True
meta.deploymentType = "Ancestor"
meta.deploymentQueryPaths.append(DeploymentPathMeta("MDevToGraphInst", "Graph Instances", "cobra.model.vns.GraphInst"))
def __init__(self, parentMoOrDn, tDn, markDirty=True, **creationProps):
namingVals = [tDn]
Mo.__init__(self, parentMoOrDn, markDirty, *namingVals, **creationProps)
# End of package file
# ##################################################
|
[
"collinsctk@qytang.com"
] |
collinsctk@qytang.com
|
608f3de73ace860822927eeb12a62de8a149c2d4
|
e2e34d01afc5b6bc6923a721ef92e8ffa8884f86
|
/tests/endtoend/http_functions/common_libs_functions/numpy_func/__init__.py
|
57d5d08e2d852b5b507e92f2ad34a1c8de1104b0
|
[
"LicenseRef-scancode-generic-cla",
"MIT"
] |
permissive
|
Azure/azure-functions-python-worker
|
094340eeb0c4728e3202749027f01ab75e908bd8
|
d4bdf7edc544b6c15e541930f890da790b180ebd
|
refs/heads/dev
| 2023-08-22T22:48:01.645722
| 2023-08-14T14:52:42
| 2023-08-14T14:52:42
| 117,730,503
| 329
| 122
|
MIT
| 2023-09-01T16:54:58
| 2018-01-16T19:23:54
|
Python
|
UTF-8
|
Python
| false
| false
| 384
|
py
|
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import logging
import azure.functions as func
import numpy as np
def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
res = "array: {}".format(np.array([1, 2], dtype=complex))
return func.HttpResponse(res)
|
[
"noreply@github.com"
] |
Azure.noreply@github.com
|
4b382d0d55c82e75b7927ff2b9427af967ea657b
|
c842cbf891b367442246f5b354f46cf48a2e3e5d
|
/src/FinalResult_csv.py
|
be18343ef9c3f10be84826845ce9eb9e3b435a3e
|
[] |
no_license
|
srishti77/sampleRecom
|
0582de4862f991b18ef089b92befc4dd0aa95095
|
414e1c07e94b4b0169544548b05d142500fee0fe
|
refs/heads/master
| 2020-03-19T12:03:04.583604
| 2018-09-23T18:17:53
| 2018-09-23T18:17:53
| 136,492,396
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,674
|
py
|
import os
import re
import pandas as pd
def getFileNames():
dir = os.listdir("D:\Recommender System\Clean Data\Ranks")
return dir
directory = getFileNames()
newDataset = pd.DataFrame(columns=['ProjectName','methodName','methodBody','methodBodyLength','TotalMN','Prefix','Rank','AllOccurrance', 'FirstOccurrance', 'LastOccurrance'])
for i in range(0,len(directory)):
dataset = pd.read_csv(directory[i])
for j in range(0, len(dataset)):
print(j)
ProjectName = dataset['ProjectName'][j]
methodName = dataset['methodName'][j]
methodBody = dataset['methodBody'][j]
methodBodyLength = dataset['methodBodyLength'][j]
TotalMN = dataset['TotalMN'][j]
Prefix = dataset['Prefix'][j]
Rank = dataset['Rank'][j]
occurrance = dataset['AllOccurrance'][j]
value = occurrance
value = value.replace('[', '')
value = value.replace(']', '')
value = value.replace(',', '')
value = value.split()
if value:
if len(value) > 1:
firstOcc = value[0]
lastOcc = value[-1]
else:
firstOcc = value[0]
lastOcc = 0
else:
firstOcc = 0
lastOcc = 0
dict = {'ProjectName': ProjectName, 'methodName': methodName,
'methodBody': methodBody,'methodBodyLength':methodBodyLength, 'TotalMN': TotalMN, 'Prefix': Prefix, 'Rank': Rank , 'AllOccurrance': occurrance, 'FirstOccurrance':firstOcc , 'LastOccurrance':lastOcc}
newDataset = newDataset.append(dict, ignore_index= True)
newDataset.to_csv('final_result.csv')
|
[
"="
] |
=
|
960c232f5a94c8236ba800deb22c0043a177002b
|
9c50f57a9cb32b44e86a0cdcbf61ead34754b085
|
/ๆ็ฉ้ด/pythonๅบ็ก/day12/ๅญฆๅ็ฎก็็ณป็ป.py
|
f3144e4039c11b48bbaf2522ae173f668aa2d929
|
[] |
no_license
|
a1403893559/rg201python
|
c3f115011981393c86a0150e5281096651712ad4
|
448f04c86e4c7fd30e3a2a4f9121b934ae1d49be
|
refs/heads/master
| 2020-03-15T23:32:17.723403
| 2018-03-18T12:59:43
| 2018-03-18T12:59:43
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 257
|
py
|
stu_a ={
'name':'liwenhao',
'age':'18'
}
stu_b = {
'name':'zhangjiayi',
'age':'1'
}
stu_c = {
'name':'yuanjianbo',
'age':'19'
}
def printStu(stu):
for k,v in stu.items():
print('k=%s,v=%s'%(k,v))
printStu(stu_a)
printStu(stu_b)
printStu(stu_c)
|
[
"wengwenyu@aliyun.com"
] |
wengwenyu@aliyun.com
|
a4984cb32bd61b190a795036bc63f2ad9c115d58
|
6683c316188abc02fc2093dfd78e994bac6cbd44
|
/asynchandler/sync.py
|
e4f1e38bb4b44925b711f259a36cef10184be27d
|
[] |
no_license
|
dexity/surfsnippets
|
e19d307d4b66336e88d1c361a00e55df089f79a4
|
00c73ebb33a2036b898c05575250e6bb28256ae7
|
refs/heads/master
| 2021-08-30T12:06:36.453468
| 2017-12-17T21:31:53
| 2017-12-17T21:31:53
| 114,569,925
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,318
|
py
|
#
# Copyright 2012 Alex Dementsov
#
# Uses inet socket to listen on incoming requests to perform blocking request
# handling (e.g. logging).
#
import os
import socket
import threading
import time
PORT = 8080
HOST = "127.0.0.1"
SOCK_FLAGS = socket.AI_PASSIVE | socket.AI_ADDRCONFIG
counter = 0 # global variable
def get_inet_socket(backlog=128):
"Blocking socket"
res = socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket.SOCK_STREAM, 0, SOCK_FLAGS)
af, socktype, proto, canonname, sockaddr = res[0]
sock = socket.socket(af, socktype, proto)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(sockaddr)
sock.listen(backlog)
return sock
def make_log(recv):
"Perform logging"
global counter
counter += 1
print "num = %s" % counter
print recv
time.sleep(1)
def main():
# Create server socket
isock = get_inet_socket()
while True:
# Get data from the inet client
conn, addr = isock.accept()
recv = conn.recv(1024)
# Blocking request handling
make_log(recv)
# Respond to the inet client
conn.send("Doobie Doo")
conn.close()
isock.close()
if __name__ == "__main__":
main()
|
[
"dexity@gmail.com"
] |
dexity@gmail.com
|
103bad2469586a40386703071346fe3f1a1168e1
|
1bdb0da31d14102ca03ee2df44f0ec522b0701a4
|
/EmiliaRomagna/HeraER/3-DataReportCollectionCollection.py
|
4b9b8c7bbef9659e460f47671de906b26e1f467e
|
[] |
no_license
|
figuriamoci/Acqua
|
dc073d90c3c5e5899b22005685847916de1dfd95
|
aef22fcd0c80c92441e0e3df2468d7a2f23a848a
|
refs/heads/master
| 2020-12-15T04:00:26.855139
| 2020-06-08T21:17:55
| 2020-06-08T21:17:55
| 234,986,179
| 1
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 3,439
|
py
|
##
from selenium import webdriver
import time
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import logging,pandas as pd
import acqua.aqueduct as aq
import acqua.parametri as parm
gestore = "HeraER"
aq.setEnv('EmiliaRomagna//'+gestore)
url = 'https://www.gruppohera.it/gruppo/attivita_servizi/business_acqua/canale_acqua/'
options = webdriver.ChromeOptions()
options.add_argument( '--ignore-certificate-errors' )
options.add_argument( '--incognito' )
options.add_argument( '--headless' )
useThisDictionary = parm.crea_dizionario('Metadata/SynParametri.csv')
parametersAdmitted = parm.getParametersAdmitted('Metadata/SynParametri.csv')
#
locationList = pd.read_csv('Metadata/LocationList.csv')
dataReportCollection = pd.DataFrame()
#locationList = locationList.iloc[57:60]
for i,location in locationList.iterrows():
alias_city = location['alias_city']
alias_address = location['alias_address']
driver = webdriver.Chrome( "chromedriver", options=options )
driver.implicitly_wait( 10 ) # seconds
driver.get( url )
time.sleep( 3 )
#
divWebElement = WebDriverWait( driver, 10 ).until(EC.visibility_of( driver.find_element_by_class_name( "form_scopricosabevi_campi" ) ) )
inputWebElement = divWebElement.find_element_by_class_name( "ui-autocomplete-input" )
inputWebElement.send_keys( alias_city.split("'")[0].split("รฌ")[0] ) #workaround: Prende solo la prima parte, prima dell'eventuale apice
time.sleep( 3 )
#Putroppo non รจ sufficiente impostare la city, per due motivi: 1) non funziona con l'apice, 2) ci possono essere piu' cittร con lo stesso prefisso, per cui in alcuni casi bisogna selezionare la cittร dala lista.
try:
popUpWebElement = WebDriverWait( driver, 10 ).until( EC.visibility_of( driver.find_element_by_id( "ui-id-2" ) ) )
optionsWebElement = popUpWebElement.find_elements_by_tag_name("li")
if len(optionsWebElement)>1:
a = {we.text:we for we in optionsWebElement}
driver.execute_script("arguments[0].click();", a[alias_city])
except:
pass
submitWebElement = divWebElement.find_element_by_class_name( "submit" )
driver.execute_script("arguments[0].click();", submitWebElement)
#
try:
time.sleep( 2 )
tableWebElement = WebDriverWait( driver, 10 ).until(EC.visibility_of( driver.find_element_by_id( "scopricosabevi-container" ) ) )
tableHtml = tableWebElement.find_elements_by_tag_name("table")[0].get_attribute('outerHTML')
#
table = pd.read_html( tableHtml, decimal=',', thousands='.' )[0]
table.set_index( table.columns[0], inplace=True )
parms = table.loc[parametersAdmitted].iloc[:,0]
#
premessa = driver.find_element_by_class_name("tdclose")
data_report = premessa.text.split("\n")[1]
#
row = {'alias_city': alias_city, 'alias_address': alias_address, 'data_report': data_report}
stdParms = parm.standardize( useThisDictionary, parms.to_dict() )
row.update( stdParms )
dataReportCollection = dataReportCollection.append( row, ignore_index=True )
logging.info( "Hacked %s (%s/%s)!", alias_city, i + 1, len( locationList ) )
except:
logging.critical( "Skiped %s!", alias_city )
driver.close()
##
dataReportCollection.to_csv('Metadata/DataReportCollection.csv',index=False)
|
[
"an.fantini@gmail.com"
] |
an.fantini@gmail.com
|
b4a83143c9715fd87929a295483544c5b43b5b4a
|
644bcdabf35261e07c2abed75986d70f736cb414
|
/python-project/Les_listes/Tri_selection_Test.py
|
6b1dccdeb2e57c4958f597688da6975535f8ac5c
|
[] |
no_license
|
matcianfa/playground-X1rXTswJ
|
f967ab2c2cf3905becafb6d77e89a31414d014de
|
67859b496e407200afb2b1d2b32bba5ed0fcc3f0
|
refs/heads/master
| 2023-04-03T11:56:15.878757
| 2023-03-24T15:52:37
| 2023-03-24T15:52:37
| 122,226,979
| 5
| 20
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,762
|
py
|
# A modifier si besoin
nom_fonction="ma_fonction"
#liste des valeurs ร tester
# Attention de bien mettre dans un tuplet ou une liste les valeurs ร tester mรชme si la fonction n'a qu'un argument.
valeurs_a_tester=[[[1,5,6]],[[3,2,5,7,10,1]],[[10,9,8,7,6,5,4,3,2,1]],[[10,9,8,7,6,5,4,3,2,1,1,2,3,4,5,6,7,8,9,10]],[[1]]]
#message d'aide si besoin
help="N'oublie pas d'utiliser return pour renvoyer le resultat."
#------------------------------------
# Les imports
import sys
# Ma boite ร outils
from ma_bao import *
# Donne les noms du dossier et du module (automatiquement avec __file__
chemin,module=donner_chemin_nom(__file__)
# On teste s'il n'y a pas d'erreurs de synthaxe etc. et on les montre si besoin
tester("from {} import *".format(module),globals())
# On renomme ma fonction f
f=eval(nom_fonction)
# Si le mot de passe est bon on affiche la correction
try :
cheat(chemin+module,mdp)
except: pass
# On rรฉcupรจre la fonction solution
exec("from {}_Correction import {} as f_sol".format(module,nom_fonction))
#--------------------------------------
def test():
try:
for valeur in valeurs_a_tester:
rep=f(*valeur)
sol=f_sol(*valeur)
assert str(rep) == str(sol), "En testant les valeurs {} le rรฉsultat obtenu est {} au lieu de {}".format(",".join([str(val) for val in valeur]),str(rep),str(sol))
send_msg("Tests validรฉs","En testant les valeurs {} le rรฉsultat obtenu est bien {}".format(",".join([str(val) for val in valeur]),str(rep)))
success(chemin+module)
except AssertionError as e:
fail()
send_msg("Oops! ", e)
if help:
send_msg("Aide ๐ก", help)
#--------------------------------------
if __name__ == "__main__": test()
|
[
"noreply@github.com"
] |
matcianfa.noreply@github.com
|
a21fbc0faec9c014211bb36d1ae2ae1a5b3b9a45
|
99eb4013a12ddac44042d3305a16edac1c9e2d67
|
/shexer/io/graph/yielder/multi_rdflib_triple_yielder.py
|
0f89fcce622acfcbe7d035a433bb4d6357b8e2c5
|
[
"Apache-2.0"
] |
permissive
|
DaniFdezAlvarez/shexer
|
cd4816991ec630a81fd9dd58a291a78af7aee491
|
7ab457b6fa4b30f9e0e8b0aaf25f9b4f4fcbf6d9
|
refs/heads/master
| 2023-05-24T18:46:26.209094
| 2023-05-09T18:25:27
| 2023-05-09T18:25:27
| 132,451,334
| 24
| 2
|
Apache-2.0
| 2023-05-03T18:39:57
| 2018-05-07T11:32:26
|
Python
|
UTF-8
|
Python
| false
| false
| 1,725
|
py
|
from shexer.io.graph.yielder.multifile_base_triples_yielder import MultifileBaseTripleYielder
from shexer.io.graph.yielder.rdflib_triple_yielder import RdflibParserTripleYielder
from shexer.consts import TURTLE
class MultiRdfLibTripleYielder(MultifileBaseTripleYielder):
def __init__(self, list_of_files, input_format=TURTLE, allow_untyped_numbers=False,
namespaces_dict=None, compression_mode=None, zip_archive_file=None):
super(MultiRdfLibTripleYielder, self).__init__(list_of_files=list_of_files,
allow_untyped_numbers=allow_untyped_numbers)
self._input_format = input_format
self._namespaces_dict = namespaces_dict if namespaces_dict is not None else {}
self._compression_mode = compression_mode
self._zip_archive_file = zip_archive_file
def _yield_triples_of_last_yielder(self, parse_namespaces=True):
for a_triple in self._last_yielder.yield_triples(parse_namespaces):
yield a_triple
def _constructor_file_yielder(self, a_source_file):
return RdflibParserTripleYielder(source=a_source_file,
allow_untyped_numbers=self._allow_untyped_numbers,
input_format=self._input_format,
compression_mode=self._compression_mode,
zip_archive_file=self._zip_archive_file)
@property
def namespaces(self):
return self._namespaces_dict # TODO This is not entirely correct. But this method will be rarely used
# and can have a huge performance cost in case the graphs hadnt been parsed yet
|
[
"danifdezalvarez@gmail.com"
] |
danifdezalvarez@gmail.com
|
dcce9e815ad8f7b9c9fd8145653e29fbb870d7f7
|
9147fb079b5abdc97d2ff7f3f578b9b4a957dfb9
|
/utils/python/linkedQueue.py
|
9fa388017779496fed3a8365a930f9f6aa97d32e
|
[] |
no_license
|
XBOOS/playgournd
|
db52bd1891d3405116dbf739ea0ae76d322e2b09
|
893b5f9e2be6ce854342f4879d9cd8db87caee2b
|
refs/heads/master
| 2021-01-10T14:34:45.292669
| 2016-03-28T15:09:56
| 2016-03-28T15:09:56
| 44,814,809
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,082
|
py
|
#!/usr/bin/env python
# encoding: utf-8
class LinkedQueue:
class _Node:
__slot__ = '_element','_next'
def __init__(self,element,next):
self.element = element
self.next = next
def __init__(self):
self.head = None
self.tail = None
self.size = 0
def __len__(self):
return self.size
def is_empty(self):
return self.size == 0
def first(self):
if self.is_empty():
raise Exception("Queue is empty")
else:
return self.head.element
def enqueue(self,e):
newNode = self._Node(e,None)
if self.is_empty():
self.head = newNode
else:
self.tail.next = newNode
self.tail = newNode
self.size +=1
def dequeue(self):
if self.is_empty():
raise Exception("Queue is empty")
else:
self.size -=1
tmp = self.head.element
self.head = self.head.next
if self.is_empty():
self.tail = None
return tmp
|
[
"xubinghku@gmail.com"
] |
xubinghku@gmail.com
|
5afa1a4402e9090797402eba39d4c47968047b57
|
d536a1e39d4b3d00ee228530490d1b03fe544f6a
|
/properties_wino.py
|
1c28a6534843672fb0d22eda31dddf77f0a7cbc1
|
[] |
no_license
|
jeffstorlie/parcels_in_minnesota_update_v02
|
dda6460b2e1f63c156d8e853a9cfcb0712b64591
|
8d7de35ddd385f2fd119374c88d8b39a14a4e064
|
refs/heads/master
| 2021-01-11T11:30:55.407132
| 2016-10-31T18:43:31
| 2016-10-31T18:44:25
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 7,420
|
py
|
from parcels_base_classes import countyEtlParams
class countyEtl(countyEtlParams):
'''Class per county with unique parameters defined.'''
def __init__(self):
self.county_name = 'Winona'
self.cty_fips = r'169'
self.county_id = r'169'
self.cty_abbr = r'WINO'
self.mngeo_web_id = r'Winona 169'
self.sourceZipFile = r'WINO_parcels.zip'
self.sourcePolygons = r'Winona_co_parcels.shp'
self.sourceOwnershipZipFile = r''
self.sourceOwnershipTable = r''
self.joinInField = r''
self.joinJoinField = r''
self.PIN_exists.fieldTransferList = []
self.BLDG_NUM_exists.fieldTransferList = []
self.BLDG_NUM_exists.transferType = ''
self.PREFIX_DIR_exists.fieldTransferList = []
self.PREFIX_DIR_exists.transferType = ''
self.PREFIXTYPE_exists.fieldTransferList = []
self.PREFIXTYPE_exists.transferType = ''
self.STREETNAME_exists.fieldTransferList = []
self.STREETNAME_exists.transferType = ''
self.STREETTYPE_exists.fieldTransferList = []
self.STREETTYPE_exists.transferType = ''
self.SUFFIX_DIR_exists.fieldTransferList = []
self.SUFFIX_DIR_exists.transferType = ''
self.UNIT_INFO_exists.fieldTransferList = []
self.UNIT_INFO_exists.transferType = ''
self.CITY_exists.fieldTransferList = []
self.CITY_exists.transferType = ''
self.CITY_USPS_exists.fieldTransferList = []
self.CITY_USPS_exists.transferType = ''
self.ZIP_exists.fieldTransferList = []
self.ZIP_exists.transferType = ''
self.ZIP4_exists.fieldTransferList = []
self.ZIP4_exists.transferType = ''
self.PLAT_NAME_exists.fieldTransferList = []
self.PLAT_NAME_exists.transferType = ''
self.BLOCK_exists.fieldTransferList = []
self.BLOCK_exists.transferType = ''
self.LOT_exists.fieldTransferList = []
self.LOT_exists.transferType = ''
self.ACRES_POLY_exists.fieldTransferList = []
self.ACRES_DEED_exists.fieldTransferList = []
self.USE1_DESC_exists.fieldTransferList = []
self.USE1_DESC_exists.transferType = ''
self.USE2_DESC_exists.fieldTransferList = []
self.USE2_DESC_exists.transferType = ''
self.USE3_DESC_exists.fieldTransferList = []
self.USE3_DESC_exists.transferType = ''
self.USE4_DESC_exists.fieldTransferList = []
self.USE4_DESC_exists.transferType = ''
self.MULTI_USES_exists.fieldTransferList = []
self.MULTI_USES_exists.transferType = ''
self.LANDMARK_exists.fieldTransferList = []
self.LANDMARK_exists.transferType = ''
self.OWNER_NAME_exists.fieldTransferList = []
self.OWNER_NAME_exists.transferType = ''
self.OWNER_MORE_exists.fieldTransferList = []
self.OWNER_MORE_exists.transferType = ''
self.OWN_ADD_L1_exists.fieldTransferList = []
self.OWN_ADD_L1_exists.transferType = ''
self.OWN_ADD_L2_exists.fieldTransferList = []
self.OWN_ADD_L2_exists.transferType = ''
self.OWN_ADD_L3_exists.fieldTransferList = []
self.OWN_ADD_L3_exists.transferType = ''
self.OWN_ADD_L4_exists.fieldTransferList = []
self.OWN_ADD_L4_exists.transferType = ''
self.TAX_NAME_exists.fieldTransferList = []
self.TAX_NAME_exists.transferType = ''
self.TAX_ADD_L1_exists.fieldTransferList = []
self.TAX_ADD_L1_exists.transferType = ''
self.TAX_ADD_L2_exists.fieldTransferList = []
self.TAX_ADD_L2_exists.transferType = ''
self.TAX_ADD_L3_exists.fieldTransferList = []
self.TAX_ADD_L3_exists.transferType = ''
self.TAX_ADD_L4_exists.fieldTransferList = []
self.TAX_ADD_L4_exists.transferType = ''
self.OWNERSHIP_exists.fieldTransferList = []
self.OWNERSHIP_exists.transferType = ''
self.HOMESTEAD_exists.fieldTransferList = []
self.HOMESTEAD_exists.transferType = ''
self.TAX_YEAR_exists.fieldTransferList = []
self.MARKET_YEAR_exists.fieldTransferList = []
self.EMV_LAND_exists.fieldTransferList = []
self.EMV_BLDG_exists.fieldTransferList = []
self.EMV_TOTAL_exists.fieldTransferList = []
self.TAX_CAPAC_exists.fieldTransferList = []
self.TOTAL_TAX_exists.fieldTransferList = []
self.SPEC_ASSES_exists.fieldTransferList = []
self.TAX_EXEMPT_exists.fieldTransferList = []
self.TAX_EXEMPT_exists.transferType = ''
self.XUSE1_DESC_exists.fieldTransferList = []
self.XUSE1_DESC_exists.transferType = ''
self.XUSE2_DESC_exists.fieldTransferList = []
self.XUSE2_DESC_exists.transferType = ''
self.XUSE3_DESC_exists.fieldTransferList = []
self.XUSE3_DESC_exists.transferType = ''
self.XUSE4_DESC_exists.fieldTransferList = []
self.XUSE4_DESC_exists.transferType = ''
self.DWELL_TYPE_exists.fieldTransferList = []
self.DWELL_TYPE_exists.transferType = ''
self.HOME_STYLE_exists.fieldTransferList = []
self.HOME_STYLE_exists.transferType = ''
self.FIN_SQ_FT_exists.fieldTransferList = []
self.GARAGE_exists.fieldTransferList = []
self.GARAGE_exists.transferType = ''
self.GARAGESQFT_exists.fieldTransferList = []
self.BASEMENT_exists.fieldTransferList = []
self.BASEMENT_exists.transferType = ''
self.HEATING_exists.fieldTransferList = []
self.HEATING_exists.transferType = ''
self.COOLING_exists.fieldTransferList = []
self.COOLING_exists.transferType = ''
self.YEAR_BUILT_exists.fieldTransferList = []
self.NUM_UNITS_exists.fieldTransferList = []
self.SALE_DATE_exists.fieldTransferList = []
self.SALE_DATE_exists.transferType = 'Date'
self.SALE_VALUE_exists.fieldTransferList = []
self.SCHOOL_DST_exists.fieldTransferList = []
self.SCHOOL_DST_exists.transferType = ''
self.WSHD_DIST_exists.fieldTransferList = []
self.WSHD_DIST_exists.transferType = ''
self.GREEN_ACRE_exists.fieldTransferList = []
self.GREEN_ACRE_exists.transferType = ''
self.OPEN_SPACE_exists.fieldTransferList = []
self.OPEN_SPACE_exists.transferType = ''
self.AG_PRESERV_exists.fieldTransferList = []
self.AG_PRESERV_exists.transferType = ''
self.AGPRE_ENRD_exists.fieldTransferList = []
self.AGPRE_ENRD_exists.transferType = 'Date'
self.AGPRE_EXPD_exists.fieldTransferList = []
self.AGPRE_EXPD_exists.transferType = 'Date'
self.PARC_CODE_exists.fieldTransferList = []
self.SECTION_exists.fieldTransferList = []
self.TOWNSHIP_exists.fieldTransferList = []
self.RANGE_exists.fieldTransferList = []
self.RANGE_DIR_exists.fieldTransferList = []
self.LEGAL_DESC_exists.fieldTransferList = []
self.LEGAL_DESC_exists.transferType = ''
self.EDIT_DATE_exists.fieldTransferList = []
self.EDIT_DATE_exists.transferType = 'Date'
self.EXPORT_DATE_exists.fieldTransferList = []
self.EXPORT_DATE_exists.transferType = 'Date'
self.ORIG_PIN_exists.fieldTransferList = []
self.ORIG_PIN_exists.transferType = ''
def returnCountyBase(self):
return county_name
|
[
"jeff.reinhart@state.mn.us"
] |
jeff.reinhart@state.mn.us
|
198cd3ffee04006604e8671de6d40a54f1429eb8
|
356a5c583fb77c53bf00b38a0d9eca761590bcf1
|
/shuwei_fengge/practice_one/Company/match_check/chin_check.py
|
6cdd9f0f46b5455f972faf3f52d49dd285b15a22
|
[
"MIT"
] |
permissive
|
sunyihuan326/DeltaLab
|
f7df7915bf4aacb7628f82ada68278c29f5942eb
|
3d20fde0763e6167c705b0c06bd033ad953719ed
|
refs/heads/master
| 2021-07-21T17:16:32.567956
| 2018-10-29T06:46:09
| 2018-10-29T06:48:27
| 108,956,765
| 1
| 2
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,063
|
py
|
# coding:utf-8
'''
Created on 2017/12/27.
@author: chk01
'''
from practice_one.Company.load_material.utils import *
def get_face_feature():
for typ in ['A', 'B', 'C', 'D', 'E']:
print('ๅผๅง{}ๅๅฏผๅ
ฅ'.format(typ))
dir_path = os.listdir(root_dir + '/src/face_' + typ)
m = len(dir_path)
n = 13
X = np.zeros([m, n, 2]) + 999
Y = np.zeros([m, 1]) + 999
for i, sourceDir in enumerate(dir_path):
_id = int(sourceDir.split('.')[0].replace(typ, '')) - 1
full_path = root_dir + '/src/face_' + typ + '/' + sourceDir
landmark72, _, _, _, _ = get_baseInfo(full_path)
landmark72 = landmark72_trans(landmark72)
_data = point2feature_chin(landmark72)
X[_id] = _data
Y[_id] = _id + 1
print('load--->{}---ๅพ{}'.format(typ, _id + 1))
scio.savemat('../load_material/feature_matrix/chin_' + typ, {"X": X, "Y": Y})
print('ๅฎๆ{}ๅฏผๅ
ฅ'.format(typ))
if __name__ == '__main__':
get_face_feature()
|
[
"chk0125@126.com"
] |
chk0125@126.com
|
36ec8c4c0a90a6281609966b27752ac39c7224de
|
eacff46eda2c6b509449979a16002b96d4645d8e
|
/Collections-a-installer/community-general-2.4.0/tests/unit/plugins/modules/remote_management/oneview/oneview_module_loader.py
|
3b41cee1b5579abf11141d265940c504e13f7613
|
[
"MIT",
"GPL-3.0-only",
"GPL-3.0-or-later"
] |
permissive
|
d-amien-b/simple-getwordpress
|
5e6d4d15d5f87124ab591e46b63fec552998fdc3
|
da90d515a0aa837b633d50db4d91d22b031c04a2
|
refs/heads/master
| 2023-04-08T22:13:37.347545
| 2021-04-06T09:25:51
| 2021-04-06T09:25:51
| 351,698,069
| 0
| 0
|
MIT
| 2021-03-31T16:16:45
| 2021-03-26T07:30:00
|
HTML
|
UTF-8
|
Python
| false
| false
| 2,399
|
py
|
# Copyright (c) 2016-2017 Hewlett Packard Enterprise Development LP
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
from ansible_collections.community.general.tests.unit.compat.mock import Mock
# FIXME: These should be done inside of a fixture so that they're only mocked during
# these unittests
sys.modules['hpOneView'] = Mock()
sys.modules['hpOneView.oneview_client'] = Mock()
ONEVIEW_MODULE_UTILS_PATH = 'ansible_collections.community.general.plugins.module_utils.oneview'
from ansible_collections.community.general.plugins.module_utils.oneview import (OneViewModuleException,
OneViewModuleTaskError,
OneViewModuleResourceNotFound,
OneViewModuleBase)
from ansible_collections.community.general.plugins.modules.remote_management.oneview.oneview_ethernet_network import EthernetNetworkModule
from ansible_collections.community.general.plugins.modules.remote_management.oneview.oneview_ethernet_network_info import EthernetNetworkInfoModule
from ansible_collections.community.general.plugins.modules.remote_management.oneview.oneview_fc_network import FcNetworkModule
from ansible_collections.community.general.plugins.modules.remote_management.oneview.oneview_fc_network_info import FcNetworkInfoModule
from ansible_collections.community.general.plugins.modules.remote_management.oneview.oneview_fcoe_network import FcoeNetworkModule
from ansible_collections.community.general.plugins.modules.remote_management.oneview.oneview_fcoe_network_info import FcoeNetworkInfoModule
from ansible_collections.community.general.plugins.modules.remote_management.oneview.oneview_network_set import NetworkSetModule
from ansible_collections.community.general.plugins.modules.remote_management.oneview.oneview_network_set_info import NetworkSetInfoModule
from ansible_collections.community.general.plugins.modules.remote_management.oneview.oneview_san_manager import SanManagerModule
from ansible_collections.community.general.plugins.modules.remote_management.oneview.oneview_san_manager_info import SanManagerInfoModule
|
[
"test@burdo.fr"
] |
test@burdo.fr
|
30f4b31f122eb742591df22a134ba0aa5db77f97
|
53fab060fa262e5d5026e0807d93c75fb81e67b9
|
/backup/user_036/ch27_2020_03_19_18_10_54_857075.py
|
f14b6d255fcb55368e95df12e32f95de78723692
|
[] |
no_license
|
gabriellaec/desoft-analise-exercicios
|
b77c6999424c5ce7e44086a12589a0ad43d6adca
|
01940ab0897aa6005764fc220b900e4d6161d36b
|
refs/heads/main
| 2023-01-31T17:19:42.050628
| 2020-12-16T05:21:31
| 2020-12-16T05:21:31
| 306,735,108
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 218
|
py
|
duvida=True
a= input('Tem duvidas? ')
if a=='nรฃo':
duvida=False
while duvida==True:
print('Pratique mais')
a= input('Tem duvidas? ')
if a == 'nรฃo':
duvida=False
print('Atรฉ a proxima')
|
[
"you@example.com"
] |
you@example.com
|
d91a7976973b3aaecd3a5b8d9a949e02417aa5e6
|
066de66c8264c4c38b8124b67232fc93ab8c84ba
|
/code/ultrasound_image/erosion_dilation.py
|
c320fe883543f5852af6357112816ae6908e1a20
|
[] |
no_license
|
Monologuethl/Monologuethl
|
d2c8ecd9c3a79c26014387db13fafd602b346401
|
844e097c29747ddf8b185bd8a36f81c03627869f
|
refs/heads/master
| 2021-09-27T07:59:40.284650
| 2021-09-15T07:17:30
| 2021-09-15T07:17:30
| 149,366,150
| 1
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,593
|
py
|
# ex2tron's blog:
# http://ex2tron.wang
import cv2
import numpy as np
# 1.่
่ไธ่จ่
path = r'C:\Users\Tong\Desktop\edgs\1.png'
img = cv2.imread(path, 0)
# kernel = np.ones((5, 5), np.uint8)
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (5, 5))
dilation = cv2.dilate(img, kernel) # ่จ่
erosion = cv2.erode(dilation, kernel) # ่
่
cv2.imshow('erosion/dilation', erosion)
cv2.waitKey(0)
#
#
# # 2.ๅฎไน็ปๆๅ
็ด
# kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (5, 5)) # ็ฉๅฝข็ปๆ
# print(kernel)
#
# kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (5, 5)) # ๆคญๅ็ปๆ
# print(kernel)
#
# kernel = cv2.getStructuringElement(cv2.MORPH_CROSS, (5, 5)) # ๅๅญๅฝข็ปๆ
# print(kernel)
#
# # 3.ๅผ่ฟ็ฎไธ้ญ่ฟ็ฎ
# kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (5, 5)) # ๅฎไน็ปๆๅ
็ด
# ๅผ่ฟ็ฎ
# img = cv2.imread(path, 0)
# opening = cv2.morphologyEx(img, cv2.MORPH_OPEN, kernel)
#
# cv2.imshow('opening', opening)
# cv2.waitKey(0)
# ้ญ่ฟ็ฎ
# img = cv2.imread(path, 0)
# closing = cv2.morphologyEx(img, cv2.MORPH_CLOSE, kernel)
#
# cv2.imshow('closing', closing)
# cv2.waitKey(0)
#
# # 4.ๅฝขๆๅญฆๆขฏๅบฆ
# img = cv2.imread(path, 0)
# gradient = cv2.morphologyEx(img, cv2.MORPH_GRADIENT, kernel)
#
# cv2.imshow('morphological gradient', gradient)
# cv2.waitKey(0)
#
#
# # 5.้กถๅธฝ
# tophat = cv2.morphologyEx(img, cv2.MORPH_TOPHAT, kernel)
# cv2.imshow('top hat', tophat)
# cv2.waitKey(0)
#
#
# # 6.้ปๅธฝ
# blackhat = cv2.morphologyEx(img, cv2.MORPH_BLACKHAT, kernel)
# cv2.imshow('black hat', blackhat)
# cv2.waitKey(0)
|
[
"2481871325@qq.com"
] |
2481871325@qq.com
|
e6247518456092b0faf2d226a25b043f1ac0f02c
|
1ebba24841912613f9c70dffee05270c4f1f4adb
|
/willie/willie/logger.py
|
d42b1b8105e094e9f41a3d5715773f794ba2532f
|
[
"EFL-2.0",
"MIT"
] |
permissive
|
freifunk-darmstadt/ffda-jarvis
|
4953af0cd8629c9b9632806eb0a7440fcf94da57
|
127f3333c837c592177f84b361e3c050e00f2d3f
|
refs/heads/master
| 2020-04-06T06:56:21.472931
| 2017-10-23T23:00:57
| 2017-10-23T23:10:03
| 32,585,430
| 0
| 8
|
MIT
| 2017-12-20T00:46:26
| 2015-03-20T13:32:00
|
Python
|
UTF-8
|
Python
| false
| false
| 1,757
|
py
|
# coding=utf8
from __future__ import unicode_literals
import logging
class IrcLoggingHandler(logging.Handler):
def __init__(self, bot, level):
super(IrcLoggingHandler, self).__init__(level)
self._bot = bot
self._channel = bot.config.core.logging_channel
def emit(self, record):
try:
msg = self.format(record)
self._bot.msg(self._channel, msg)
except (KeyboardInterrupt, SystemExit):
raise
except:
self.handleError(record)
class ChannelOutputFormatter(logging.Formatter):
def __init__(self):
super(ChannelOutputFormatter, self).__init__(
fmt='[%(filename)s] %(msg)s'
)
def formatException(self, exc_info):
# logging will through a newline between the message and this, but
# that's fine because Willie will strip it back out anyway
return ' - ' + repr(exc_info[1])
def setup_logging(bot):
level = bot.config.core.logging_level or 'WARNING'
logging.basicConfig(level=level)
logger = logging.getLogger('willie')
if bot.config.core.logging_channel:
handler = IrcLoggingHandler(bot, level)
handler.setFormatter(ChannelOutputFormatter())
logger.addHandler(handler)
def get_logger(name=None):
"""Return a logger for a module, if the name is given.
This is equivalent to `logging.getLogger('willie.modules.' + name)` when
name is given, and `logging.getLogger('willie')` when it is not. The latter
case is intended for use in Willie's core; modules should call
`get_logger(__name__)` to get a logger."""
if name:
return logging.getLogger('willie.modules.' + name)
else:
return logging.getLogger('willie')
|
[
"mweinelt@gmail.com"
] |
mweinelt@gmail.com
|
6df027365ad433140946c4c093f2ee39cfc26526
|
2dd560dc468af0af4ca44cb4cd37a0b807357063
|
/Leetcode/1529. Bulb Switcher IV/solution1.py
|
f1587218df3a9dfc14a2d51b3abd51f8be2498f8
|
[
"MIT"
] |
permissive
|
hi0t/Outtalent
|
460fe4a73788437ba6ce9ef1501291035c8ff1e8
|
8a10b23335d8e9f080e5c39715b38bcc2916ff00
|
refs/heads/master
| 2023-02-26T21:16:56.741589
| 2021-02-05T13:36:50
| 2021-02-05T13:36:50
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 214
|
py
|
class Solution:
def minFlips(self, target: str) -> int:
result = 0
t = 1
for c in target:
if c == t:
t ^= 1
result += 1
return result
|
[
"info@crazysquirrel.ru"
] |
info@crazysquirrel.ru
|
08b83b2689775ecf6db9cf7dabdbce19d580cae5
|
3fc4cac282465350d9b2983527140fc735a0d273
|
/0916/04_graphSigmoid.py
|
040f25ec9ae21cfcc14c0de514865e0b9198d73b
|
[] |
no_license
|
Orderlee/SBA_STUDY
|
2cfeea54d4a9cbfd0c425e1de56324afcc547b81
|
4642546e7546f896fc8b06e9daba25d27c29e154
|
refs/heads/master
| 2022-12-25T01:08:05.168970
| 2020-09-27T14:57:23
| 2020-09-27T14:57:23
| 299,050,168
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,159
|
py
|
import numpy as np
import matplotlib.pyplot as plt
def sigmoid(weight,x,b=0 ,asc=True):
if asc == True:
return 1/(1+np.exp(-weight * x -b))
else:
return 1/(1 + np.exp(+weight * x + b))
# arange ํจ์๋ ํ์ด์ฌ range์ ์ ์ฌํจ
x = np.arange(-5.0,5.1,0.1)
weight,bias = 1,0
y1 = sigmoid(weight,x)
mylabel= 'y=' +str(weight) +'*x +' + str(bias)
plt.plot(x,y1, color='g', label=mylabel)
weight,bias = 5,0
y2 = sigmoid(weight,x,bias)
mylabel= 'y=' +str(weight) +'*x +' + str(bias)
plt.plot(x,y2, color='b', label=mylabel)
weight,bias = 5,3
y3 = sigmoid(weight,x,bias)
mylabel= 'y=' +str(weight) +'*x +' + str(bias)
plt.plot(x,y3, color='r', label=mylabel)
weight,bias = 5,3
y4 = sigmoid(weight,x,bias,asc=False)
mylabel= 'y=' +str(weight) +'*x +' + str(bias)
plt.plot(x,y4, color='r', label=mylabel)
plt.axhline(y=0,color='black',linewidth=1, linestyle='dashed')
plt.axhline(y=1,color='black',linewidth=1, linestyle='dashed')
plt.title('sigmoid function')
plt.ylim(-0.1,1.1)
plt.legend(loc='best')
filename='sigmoid_function.png'
plt.savefig(filename)
print(filename +' ํ์ผ์ด ์ ์ฅ๋์์ต๋๋ค.')
print('finished')
|
[
"61268230+Orderlee@users.noreply.github.com"
] |
61268230+Orderlee@users.noreply.github.com
|
6aff12c0caf1b015d7f25d02d7caf535f388b708
|
6f30245f27a9568155f69648faf148c278136029
|
/hhapps/stock/api/models/stocks.py
|
523f821e7c018e0a2f210f16c8b01f46550ef3e9
|
[] |
no_license
|
r202-coe-psu/hh-apps
|
82495ffec7fb09155afa4e8f571051aad824acb4
|
a15453b7f502a2a71ccb89ba4c4ebe95ef3ca86f
|
refs/heads/master
| 2021-05-03T05:48:40.766349
| 2017-08-06T22:45:30
| 2017-08-06T22:45:30
| 120,584,239
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 714
|
py
|
import mongoengine as me
import datetime
from .common import User, Building
class Stock(me.Document):
name = me.StringField(required=True)
description = me.StringField()
tags = me.ListField(me.StringField())
owner = me.EmbeddedDocumentField(User)
building = me.EmbeddedDocumentField(Building)
status = me.StringField(required=True, default='deactivate')
created_date = me.DateTimeField(required=True,
default=datetime.datetime.utcnow)
updated_date = me.DateTimeField(required=True,
default=datetime.datetime.utcnow,
auto_now=True)
meta = {'collection': 'stocks'}
|
[
"boatkrap@gmail.com"
] |
boatkrap@gmail.com
|
8ee86e9a15eadb51909cffb7a5aab5e11ece6a78
|
56f5b2ea36a2258b8ca21e2a3af9a5c7a9df3c6e
|
/CMGTools/H2TauTau/prod/25aug_corrMC/up/mc/SUSYGluGluToHToTauTau_M-250_8TeV-pythia6-tauola/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/PAT_CMG_V5_16_0_1377467513/HTT_24Jul_newTES_manzoni_Up_Jobs/Job_24/run_cfg.py
|
276345c186bf8da137a00aa8ad103b6b8f80b0b9
|
[] |
no_license
|
rmanzoni/HTT
|
18e6b583f04c0a6ca10142d9da3dd4c850cddabc
|
a03b227073b2d4d8a2abe95367c014694588bf98
|
refs/heads/master
| 2016-09-06T05:55:52.602604
| 2014-02-20T16:35:34
| 2014-02-20T16:35:34
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,181
|
py
|
import FWCore.ParameterSet.Config as cms
import os,sys
sys.path.append('/afs/cern.ch/user/m/manzoni/summer13/CMGTools/CMSSW_5_3_9/src/CMGTools/H2TauTau/prod/25aug_corrMC/up/mc/SUSYGluGluToHToTauTau_M-250_8TeV-pythia6-tauola/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/PAT_CMG_V5_16_0_1377467513/HTT_24Jul_newTES_manzoni_Up_Jobs')
from base_cfg import *
process.source = cms.Source("PoolSource",
noEventSort = cms.untracked.bool(True),
inputCommands = cms.untracked.vstring('keep *',
'drop cmgStructuredPFJets_cmgStructuredPFJetSel__PAT'),
duplicateCheckMode = cms.untracked.string('noDuplicateCheck'),
fileNames = cms.untracked.vstring('/store/cmst3/group/cmgtools/CMG/SUSYGluGluToHToTauTau_M-250_8TeV-pythia6-tauola/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/PAT_CMG_V5_16_0/cmgTuple_74_1_st7.root',
'/store/cmst3/group/cmgtools/CMG/SUSYGluGluToHToTauTau_M-250_8TeV-pythia6-tauola/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/PAT_CMG_V5_16_0/cmgTuple_75_1_riU.root',
'/store/cmst3/group/cmgtools/CMG/SUSYGluGluToHToTauTau_M-250_8TeV-pythia6-tauola/Summer12_DR53X-PU_S10_START53_V7A-v1/AODSIM/PAT_CMG_V5_16_0/cmgTuple_76_1_eBF.root')
)
|
[
"riccardo.manzoni@cern.ch"
] |
riccardo.manzoni@cern.ch
|
8fdca3e58563ff24f711fef8de5dab6419e9d7cf
|
6fa7f99d3d3d9b177ef01ebf9a9da4982813b7d4
|
/pn7QpvW2fW9grvYYE_9.py
|
43273e64b5256518234f94d6178e37a7d1fb8af5
|
[] |
no_license
|
daniel-reich/ubiquitous-fiesta
|
26e80f0082f8589e51d359ce7953117a3da7d38c
|
9af2700dbe59284f5697e612491499841a6c126f
|
refs/heads/master
| 2023-04-05T06:40:37.328213
| 2021-04-06T20:17:44
| 2021-04-06T20:17:44
| 355,318,759
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 351
|
py
|
def find_fulcrum(lst):
for i in range(1,len(lst)):
if i!=(len(lst)-1):
n1 = lst[:i]
n2 = lst[i+1:]
if sum(n1) == sum(n2):
print(n1)
print(n2)
return lst[i]
break
else:
pass
else:
return -1
|
[
"daniel.reich@danielreichs-MacBook-Pro.local"
] |
daniel.reich@danielreichs-MacBook-Pro.local
|
ee58c2d78d9dcc0d17e6b124f569983d5e86a0fc
|
ca7aa979e7059467e158830b76673f5b77a0f5a3
|
/Python_codes/p02269/s622276745.py
|
706ea0b7997e1bf35c0458a5c0dfaf699bc42e03
|
[] |
no_license
|
Aasthaengg/IBMdataset
|
7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901
|
f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8
|
refs/heads/main
| 2023-04-22T10:22:44.763102
| 2021-05-13T17:27:22
| 2021-05-13T17:27:22
| 367,112,348
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,413
|
py
|
class HashTable:
@staticmethod
def h1(key):
return key % 1046527
@staticmethod
def h2(key):
return 1 + (key % (1046527 - 1))
def __init__(self, size):
self.size = size
self.values = [None for _ in range(size)]
self.tables = str.maketrans({
'A':'1', 'C':'2', 'G':'3', 'T':'4',
})
def translate_key(self, value):
return int(value.translate(self.tables))
def find(self, value):
count = 0
key = self.translate_key(value)
while True:
h = (HashTable.h1(key) + count * HashTable.h2(key)) % 1046527
if self.values[h] == value:
return True
elif self.values[h] is None:
return False
count += 1
return False
def insert(self, value):
count = 0
key = self.translate_key(value)
while True:
h = (HashTable.h1(key) + count * HashTable.h2(key)) % 1046527
if self.values[h] is None:
self.values[h] = value
break
count += 1
num = int(input())
dictionary = HashTable(1046527)
for _ in range(num):
command, value = input().split()
if command == "insert":
dictionary.insert(value)
elif command == "find":
is_find = dictionary.find(value)
print("yes" if is_find else "no")
|
[
"66529651+Aastha2104@users.noreply.github.com"
] |
66529651+Aastha2104@users.noreply.github.com
|
9dcf4b2832852c6fe2a69c4925b60ca92503bbfc
|
9114d6d9f535ad0fc6149f1ef1c49f7005926cdc
|
/week4/ji/Step/10/Q1978.py
|
ed20837262a31ccf27e24743440b0d5488895159
|
[] |
no_license
|
HyeonGyuChi/knu_likelion_study
|
914c20af54e3973361551a3defa88b14f9731853
|
81ba84bbd00d76b5a2870637cf4cce8b05e15678
|
refs/heads/master
| 2020-05-03T12:59:01.539664
| 2019-05-21T13:14:10
| 2019-05-21T13:14:10
| 178,641,355
| 2
| 0
| null | 2019-04-06T16:57:07
| 2019-03-31T04:14:57
| null |
UTF-8
|
Python
| false
| false
| 2,483
|
py
|
'''
๋ฐฑ์ค ๋จ๊ณ๋ณํ๊ธฐ step 10
https://www.acmicpc.net/problem/1978
'''
'''
์ฝ์ = ์ด๋ค์๋ก ๋๋์์ ๋ ๋๋จธ์ง๊ฐ 0์ธ ์
์์ = ์ฝ์์ค 1๊ณผ ์๊ธฐ ์์ ๋ฟ์ธ ์(๋จ, 1์ ์์๊ฐ x)
์์๋ฅผ ๊ฑธ๋ฌ๋ด๋ ๊ท์น์ ์์
'์๋ผํ ์ค์ฒด๋ค์ค์ ์ฒด' ๋ฐฉ๋ฒ์ ์ด์ฉํด ๋ฐฐ์๋ค์ ์ง์๋๊ฐ๋ ๋ฐฉ๋ฒ์ ์ด์ฉ
๋ง์ฝ 1~100 ๊น์ง์์ ์์๋ฅผ ๊ตฌํด์ผ ํ๋ค๋ฉด
2์๋ฐฐ์, 3์๋ฐฐ์, 5์๋ฐฐ์ ๋ฑ์ ์์๋ก ์๋ฅผ ์ง์๋๊ฐ๋ ๋ฒ
์ฆ, ํ์ํ๋ ์๊ฐ
ํ์ํ๋ ์๋ณด๋ค ์์ ๊ธฐ์กด์ ์์๋ฅผ ํฌํจํ ๊ณฑ์ผ๋ก ํํ์ด ๋ถ๊ฐํ ๋ ์์
์?
์์๊ฐ ์ถ๊ฐ๋ ๋๋ง๋ค ์์๋ฅผ ํฌํจํ ๋ฐฐ์๋ค์ ๋ชจ๋ ์ ๊ฑฐ
๊ธฐ์กด์ ์์์ ๋ฐฐ์๋ค์ ์ ๊ฑฐํ๋๋ฐ๋ ๋จ์์๋ ์๋ผ๋ฉด ๊ทธ ์๋ ์์
๊ธฐ์กด์ ์์์ ๊ณฑ์
์ผ๋ก ํํ๊ฐ๋ฅ ํ๋ค๋ฉด ์์๊ฐ ์๋๋ฏ๋ก
๊ทธ ์์ ๋ฐฐ์๋ฅผ ๋ชจ๋ ์ ์ธ
'''
'''
์
๋ ฅํ ์๋ฅผ 2๋ถํฐ ์
๋ ฅํ ์ ์ด์ ๊น์ง ๋๋ด์ ๋ ๋๋จธ์ง๊ฐ 0์ด ์๋๋ผ๋ฉด ์์
# 100 * 1000 ์ผ๊ฒฝ์ฐ 100๋ฒ * 999๋ฒ์ ํด์ผํจ
# ๋ฐ์ ์๊ณ ๋ฆฌ์ฆ์ ๊ฒฝ์ฐ max๋ฅผ ์ฐพ์์ผ ํ๋ ์๊ฐ๋ณต์ก๋๊ฐ ์ถ๊ฐ๋์ง๋ง
# max๋ฅผ ๊ธฐ์ค์ผ๋ก 1~max์ฌ์ด์ ์์๋ฅผ ์ฐพ๊ธฐ์ํด ํ ์ฌ์ดํด๋น
ํ์์์์ ๊ฐ์๋งํผ๋ง ๋ฐ๋ณตํ๋ฏ๋ก
# ์๊ฐ๋ณต์ก๋ ์ ๋ฆฌ
# 1. ์
๋ ฅํ ์๋ค ์ค ๊ฐ์ฅ ํฐ max๋ฅผ ์ฐพ์
# 2. max๋ฅผ ๊ธฐ์ค์ผ๋ก 1~max์ฌ์ด์ ์์๋ฅผ ์ฐพ์
# 3. ์
๋ ฅํ ์๊ฐ 2์์ ์ฐพ์ ์์๋ค ์ค ํ๋ ์ธ์ง ํ์ธ
'''
# 1. ๊ฐ์ฅ max๊ฐ ๊ตฌํ๊ธฐ
count = int(input()) # ์
๋ ฅํ ๊ฐ์
data = list(map(int, input().split())) # ์
๋ ฅํ ๋ฐ์ดํฐ
max = max(data) # ์
๋ ฅํ ์์ค ๊ฐ์ฅ ํฐ ๊ฐ
# 2.1~max์ฌ์ด์ ์์ ์ฐพ๊ธฐ
prime = [] # ์์๋ฅผ ์ ์ฅํ ๋ฐฐ์ด
# 1์ ์์๊ฐ ์๋๋ฏ๋ก 2๋ถํฐ ๊ฒ์
for num in range(2,max+1) :
IsPrime = True # ์์์ธ์ง ํ๋ณ
for p in prime :
if num % p == 0 : # ์์์ ๊ณฑ์ผ๋ก ํํ๊ฐ๋ฅ
IsPrime = False
break # (ํ๋ฒ์ด๋ผ๋ ํํ๊ฐ๋ฅํ๋ค๋ฉด ์ข
๋ฃ)
if IsPrime : # ๋ชจ๋ ์์์ ๊ณฑ์ผ๋ก ํํ์ด ๋ถ๊ฐํ๋ค๋ฉด ์์
prime.append(num) # ์์์ถ๊ฐ
#3. ์
๋ ฅ data๊ฐ max์ฌ์ด์ ์์๋ค ์ค ํ๋์ธ์ง ํ์ธํ์ฌ ๊ฐ์์ฐพ๊ธฐ
prime_count = 0
for num in data :
if num in prime:
prime_count+= 1
print(prime_count)
''' ์ฉ๋ ์ฝ๋ > ๋ฌด์จ๋ง์ด์ผ;
input()
print(sum((10103**~-A%A<2)-(A in[1,561,645,946])for A in map(int,input().split())))
'''
|
[
"hyeongyuc96@gmail.com"
] |
hyeongyuc96@gmail.com
|
7cc8fb975e2594868fba5c6a7d293a405155e56f
|
0b793bce2da8c3d09b7956c0672ddbffd46feaed
|
/codechef/ltime27_mnmx.py
|
2d3c50f204e2d847bf17cc8fb2717afc78c92dad
|
[
"MIT"
] |
permissive
|
knuu/competitive-programming
|
c6c4e08fb231937d988bdc5a60a8ad6b31b97616
|
16bc68fdaedd6f96ae24310d697585ca8836ab6e
|
refs/heads/master
| 2021-01-17T09:39:02.647688
| 2020-11-07T03:17:22
| 2020-11-07T03:17:22
| 27,886,732
| 1
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 248
|
py
|
def read_list(t): return [t(x) for x in input().split()]
def read_line(t): return t(input())
def read_lines(t, N): return [t(input()) for _ in range(N)]
for i in range(read_line(int)):
N = read_line(int)
print(min(read_list(int)) * (N-1))
|
[
"premier3next@gmail.com"
] |
premier3next@gmail.com
|
1b76b2e7b6aec0cfb2273733e398fb2a5faa6cba
|
00a9295409b78a53ce790f7ab44931939f42c0e0
|
/FPGA/apio/iCEBreaker/FIR_Filter/sympy/venv/lib/python3.8/site-packages/sympy/physics/__init__.py
|
58134cc0bd994e507cfc140be6c8a6f0fee9425f
|
[
"Apache-2.0"
] |
permissive
|
klei22/Tech-OnBoarding-Class
|
c21f0762d2d640d5e9cb124659cded5c865b32d4
|
960e962322c37be9117e0523641f8b582a2beceb
|
refs/heads/master
| 2022-11-10T13:17:39.128342
| 2022-10-25T08:59:48
| 2022-10-25T08:59:48
| 172,292,871
| 2
| 3
|
Apache-2.0
| 2019-05-19T00:26:32
| 2019-02-24T03:50:35
|
C
|
UTF-8
|
Python
| false
| false
| 219
|
py
|
"""
A module that helps solving problems in physics
"""
from . import units
from .matrices import mgamma, msigma, minkowski_tensor, mdft
__all__ = [
'units',
'mgamma', 'msigma', 'minkowski_tensor', 'mdft',
]
|
[
"kaunalei@gmail.com"
] |
kaunalei@gmail.com
|
db382e2598d7f7d28f75a456f6e4a16fa2887c82
|
f09c8bd2f4e6eb99d8c90dbd7e36400ca5b86c2b
|
/test_color_space.py
|
928a75d5e812967d8d54bc3a4a53af89e6e62a4a
|
[
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] |
permissive
|
lejeunel/selective-search
|
6fa2f15323f7c42bde3801175a65bb9f2c58676b
|
a2f2ec6cea5c011b2d3763875c9173f2948d4fd4
|
refs/heads/master
| 2022-10-19T00:23:24.306458
| 2019-10-09T08:38:39
| 2019-10-09T08:38:39
| 99,547,790
| 0
| 0
|
MIT
| 2022-09-30T19:45:54
| 2017-08-07T07:07:39
|
Makefile
|
UTF-8
|
Python
| false
| false
| 3,314
|
py
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
import numpy
from color_space import *
class TestColorSpace:
def _assert_range(self, img):
assert img.dtype == numpy.uint8
assert img.shape == (10, 10, 3)
assert 0 <= numpy.min(img)
assert 1 < numpy.max(img) <= 255
def setup_method(self, method):
self.I = numpy.ndarray((10, 10, 3), dtype=numpy.uint8)
self.I[:, :, 0] = 50
self.I[:, :, 1] = 100
self.I[:, :, 2] = 150
self.Irand = numpy.random.randint(0, 256, (10, 10, 3)).astype(numpy.uint8)
def test_to_grey_range(self):
self._assert_range(to_grey(self.Irand))
def test_to_grey_value(self):
img = to_grey(self.I)
grey_value = int(0.2125 * 50 + 0.7154 * 100 + 0.0721 * 150)
assert ((img == grey_value).all())
def test_to_Lab_range(self):
self._assert_range(to_Lab(self.Irand))
def test_to_Lab_value(self):
img = to_Lab(self.I)
def test_to_rgI_range(self):
self._assert_range(to_rgI(self.Irand))
def test_to_rgI_value(self):
img = to_rgI(self.I)
grey_value = int(0.2125 * 50 + 0.7154 * 100 + 0.0721 * 150)
assert ((img[:, :, 0] == 50).all())
assert ((img[:, :, 1] == 100).all())
assert ((img[:, :, 2] == grey_value).all())
def test_to_HSV_range(self):
self._assert_range(to_HSV(self.Irand))
def test_to_HSV_value(self):
img = to_HSV(self.I)
h, s, v = 148, 170, 150
assert ((img[:, :, 0] == h).all())
assert ((img[:, :, 1] == s).all())
assert ((img[:, :, 2] == v).all())
def test_to_nRGB_range(self):
self._assert_range(to_nRGB(self.Irand))
def test_to_nRGB_value(self):
img = to_nRGB(self.I)
denom = numpy.sqrt(50 ** 2 + 100 ** 2 + 150 ** 2) / 255.0
r, g, b = 50 / denom, 100 / denom, 150 / denom
assert ((img[:, :, 0] == int(r)).all())
assert ((img[:, :, 1] == int(g)).all())
assert ((img[:, :, 2] == int(b)).all())
def test_to_Hue_range(self):
self._assert_range(to_Hue(self.Irand))
def test_to_Hue_value(self):
img = to_Hue(self.I)
expected_h = 148
assert ((img[:, :, 0] == expected_h).all())
assert ((img[:, :, 1] == expected_h).all())
assert ((img[:, :, 2] == expected_h).all())
def test_convert_color_nonexisting_color(self):
with pytest.raises(KeyError):
convert_color(self.Irand, 'nonexisting-colorspace')
def test_convert_color_give_singlechannel_image(self):
I = numpy.random.randint(0, 255, (10, 10)).astype(numpy.uint8)
assert numpy.array_equal(convert_color(I, 'rgb')[:, :, 0], I)
def test_convert_color_value(self):
assert numpy.array_equal(convert_color(self.Irand, 'rgb'), self.Irand)
assert numpy.array_equal(convert_color(self.Irand, 'lab'), to_Lab(self.Irand))
assert numpy.array_equal(convert_color(self.Irand, 'rgi'), to_rgI(self.Irand))
assert numpy.array_equal(convert_color(self.Irand, 'hsv'), to_HSV(self.Irand))
assert numpy.array_equal(convert_color(self.Irand, 'nrgb'), to_nRGB(self.Irand))
assert numpy.array_equal(convert_color(self.Irand, 'hue'), to_Hue(self.Irand))
|
[
"olol85@gmail.com"
] |
olol85@gmail.com
|
25aa1fe53e08944cde76920458b0c7db7238e2d6
|
d13aeac99a5af94d8f27ee64c6aa7c354fa56497
|
/backend/shiny_smoke_26439/urls.py
|
43c4e9f037be6718bda97425918834b20d966782
|
[] |
no_license
|
crowdbotics-apps/shiny-smoke-26439
|
ec68cde6e144fe64884685542316f8afab1a09cb
|
28b1e1e55476dedee990f6c0fd15b1c700cbfdf3
|
refs/heads/master
| 2023-05-01T00:15:17.114141
| 2021-05-09T15:01:46
| 2021-05-09T15:01:46
| 365,779,580
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,229
|
py
|
"""shiny_smoke_26439 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include, re_path
from django.views.generic.base import TemplateView
from allauth.account.views import confirm_email
from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
urlpatterns = [
path("", include("home.urls")),
path("accounts/", include("allauth.urls")),
path("modules/", include("modules.urls")),
path("api/v1/", include("home.api.v1.urls")),
path("admin/", admin.site.urls),
path("users/", include("users.urls", namespace="users")),
path("rest-auth/", include("rest_auth.urls")),
# Override email confirm to use allauth's HTML view instead of rest_auth's API view
path("rest-auth/registration/account-confirm-email/<str:key>/", confirm_email),
path("rest-auth/registration/", include("rest_auth.registration.urls")),
]
admin.site.site_header = "Shiny Smoke"
admin.site.site_title = "Shiny Smoke Admin Portal"
admin.site.index_title = "Shiny Smoke Admin"
# swagger
api_info = openapi.Info(
title="Shiny Smoke API",
default_version="v1",
description="API documentation for Shiny Smoke App",
)
schema_view = get_schema_view(
api_info,
public=True,
permission_classes=(permissions.IsAuthenticated,),
)
urlpatterns += [
path("api-docs/", schema_view.with_ui("swagger", cache_timeout=0), name="api_docs")
]
urlpatterns += [path("", TemplateView.as_view(template_name='index.html'))]
urlpatterns += [re_path(r"^(?:.*)/?$",
TemplateView.as_view(template_name='index.html'))]
|
[
"team@crowdbotics.com"
] |
team@crowdbotics.com
|
72e94c64794120f05d3a89ff10fff155d3090d7b
|
7ae0ffa2168cf6ac22aca623f6d92ff84bf82a9e
|
/python/p071.py
|
62ff3afd861e905e5117e1ffba796abd5081d8bc
|
[
"LicenseRef-scancode-warranty-disclaimer"
] |
no_license
|
nttan/Project-Euler-solutions
|
a4e53783ae5da36cb45ea33bd2f33aed277db627
|
5e7d16559bd9ad072448a35f8edac576081056f6
|
refs/heads/master
| 2021-01-18T13:40:53.315063
| 2016-01-06T04:49:16
| 2016-01-06T04:49:16
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 485
|
py
|
#
# Solution to Project Euler problem 71
# by Project Nayuki
#
# http://www.nayuki.io/page/project-euler-solutions
# https://github.com/nayuki/Project-Euler-solutions
#
import sys
if sys.version_info.major == 2:
range = xrange
def compute():
maxnumer = 0
maxdenom = 1
for d in range(2, 1000001):
n = d * 3 // 7
if d % 7 == 0:
n -= 1
if n * maxdenom > d * maxnumer:
maxnumer = n
maxdenom = d
return str(maxnumer)
if __name__ == "__main__":
print(compute())
|
[
"nayuki@eigenstate.org"
] |
nayuki@eigenstate.org
|
c653396b8ff06da0ed0fbbe3a1a55261e785f72a
|
df4a7c46c46d1eca6570493b9707bdf64e54f8d3
|
/py/226.invert-binary-tree.py
|
4f998161a7caf7bd11cb762cee6bb52c513da42f
|
[] |
no_license
|
CharmSun/my-leetcode
|
52a39bf719c507fb7032ed424fe857ba7340aea3
|
5325a56ba8c40d74d9fef2b19bac63a4e2c44a38
|
refs/heads/master
| 2023-03-29T06:39:49.614264
| 2021-03-28T16:33:52
| 2021-03-28T16:33:52
| 261,364,001
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 626
|
py
|
#
# @lc app=leetcode id=226 lang=python3
#
# [226] Invert Binary Tree
#
# @lc code=start
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
# ๆๅๅบ้ๅฝ
def invertTree(self, root: TreeNode) -> TreeNode:
if not root:
return None
left_child = self.invertTree(root.left)
right_child = self.invertTree(root.right)
root.left = right_child
root.right = left_child
return root
# @lc code=end
|
[
"suncan0812@gmail.com"
] |
suncan0812@gmail.com
|
92e956d90cbde985404e992cfb58c3b2353845ee
|
6e4e6b64c035881f1cff39db616b0a80e1568c51
|
/ABC095/q2.py
|
03ae7f4a8faaa3f620ab29a4a57a1a728edb1f6e
|
[] |
no_license
|
Lischero/Atcoder
|
f7471a85ee553e3ae791e3e5670468aea1fa53cc
|
f674d6a20a56eebdafa6d50d5d2d0f4030e5eace
|
refs/heads/master
| 2020-05-21T16:23:36.095929
| 2018-10-18T04:27:55
| 2018-10-18T04:27:55
| 60,671,810
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 337
|
py
|
# -*- coding:utf-8 -*-
if __name__ == "__main__":
n, x = map(int, input().split())
m = [ int(input()) for _ in range(n) ]
ans = len(m)
singleWeight = sum(m)
surplus = x - singleWeight
if surplus > 0:
ans += surplus//min(m)
surplus -= min(m)*(surplus//min(m))
else:
pass
print(ans)
|
[
"vermouth.lischero@gmail.com"
] |
vermouth.lischero@gmail.com
|
c0be77f66a52f0549e9eed79e2857478ca5e0776
|
c5b9f0fabffb6b2d13c6e350c8187a922709ac60
|
/devel/.private/pal_detection_msgs/lib/python2.7/dist-packages/pal_detection_msgs/msg/_Gesture.py
|
ae0174ce103dd369b02deae542cd4e68ed7ceb15
|
[] |
no_license
|
MohamedEhabHafez/Sorting_Aruco_Markers
|
cae079fdce4a14561f5e092051771d299b06e789
|
0f820921c9f42b39867565441ed6ea108663ef6c
|
refs/heads/master
| 2020-12-09T02:43:00.731223
| 2020-01-15T17:31:29
| 2020-01-15T17:31:29
| 233,154,293
| 0
| 0
| null | 2020-10-13T18:46:44
| 2020-01-11T00:41:38
|
Makefile
|
UTF-8
|
Python
| false
| false
| 8,082
|
py
|
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from pal_detection_msgs/Gesture.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import geometry_msgs.msg
import std_msgs.msg
class Gesture(genpy.Message):
_md5sum = "1bc7e8240ed437c7df9ff2c69342d63a"
_type = "pal_detection_msgs/Gesture"
_has_header = True #flag to mark the presence of a Header object
_full_text = """## Contains data relative to recognized gestures
Header header
# Gesture identifier
string gestureId
# Position of the hand when the gesture was recognized in the camera frame in m
geometry_msgs/Point position3D
================================================================================
MSG: std_msgs/Header
# Standard metadata for higher-level stamped data types.
# This is generally used to communicate timestamped data
# in a particular coordinate frame.
#
# sequence ID: consecutively increasing ID
uint32 seq
#Two-integer timestamp that is expressed as:
# * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')
# * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')
# time-handling sugar is provided by the client library
time stamp
#Frame this data is associated with
# 0: no frame
# 1: global frame
string frame_id
================================================================================
MSG: geometry_msgs/Point
# This contains the position of a point in free space
float64 x
float64 y
float64 z
"""
__slots__ = ['header','gestureId','position3D']
_slot_types = ['std_msgs/Header','string','geometry_msgs/Point']
def __init__(self, *args, **kwds):
"""
Constructor. Any message fields that are implicitly/explicitly
set to None will be assigned a default value. The recommend
use is keyword arguments as this is more robust to future message
changes. You cannot mix in-order arguments and keyword arguments.
The available fields are:
header,gestureId,position3D
:param args: complete set of field values, in .msg order
:param kwds: use keyword arguments corresponding to message field names
to set specific fields.
"""
if args or kwds:
super(Gesture, self).__init__(*args, **kwds)
#message fields cannot be None, assign default values for those that are
if self.header is None:
self.header = std_msgs.msg.Header()
if self.gestureId is None:
self.gestureId = ''
if self.position3D is None:
self.position3D = geometry_msgs.msg.Point()
else:
self.header = std_msgs.msg.Header()
self.gestureId = ''
self.position3D = geometry_msgs.msg.Point()
def _get_types(self):
"""
internal API method
"""
return self._slot_types
def serialize(self, buff):
"""
serialize message into buffer
:param buff: buffer, ``StringIO``
"""
try:
_x = self
buff.write(_get_struct_3I().pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
_x = self.header.frame_id
length = len(_x)
if python3 or type(_x) == unicode:
_x = _x.encode('utf-8')
length = len(_x)
buff.write(struct.pack('<I%ss'%length, length, _x))
_x = self.gestureId
length = len(_x)
if python3 or type(_x) == unicode:
_x = _x.encode('utf-8')
length = len(_x)
buff.write(struct.pack('<I%ss'%length, length, _x))
_x = self
buff.write(_get_struct_3d().pack(_x.position3D.x, _x.position3D.y, _x.position3D.z))
except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))
def deserialize(self, str):
"""
unpack serialized message in str into this message instance
:param str: byte array of serialized message, ``str``
"""
try:
if self.header is None:
self.header = std_msgs.msg.Header()
if self.position3D is None:
self.position3D = geometry_msgs.msg.Point()
end = 0
_x = self
start = end
end += 12
(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _get_struct_3I().unpack(str[start:end])
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
start = end
end += length
if python3:
self.header.frame_id = str[start:end].decode('utf-8')
else:
self.header.frame_id = str[start:end]
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
start = end
end += length
if python3:
self.gestureId = str[start:end].decode('utf-8')
else:
self.gestureId = str[start:end]
_x = self
start = end
end += 24
(_x.position3D.x, _x.position3D.y, _x.position3D.z,) = _get_struct_3d().unpack(str[start:end])
return self
except struct.error as e:
raise genpy.DeserializationError(e) #most likely buffer underfill
def serialize_numpy(self, buff, numpy):
"""
serialize message with numpy array types into buffer
:param buff: buffer, ``StringIO``
:param numpy: numpy python module
"""
try:
_x = self
buff.write(_get_struct_3I().pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
_x = self.header.frame_id
length = len(_x)
if python3 or type(_x) == unicode:
_x = _x.encode('utf-8')
length = len(_x)
buff.write(struct.pack('<I%ss'%length, length, _x))
_x = self.gestureId
length = len(_x)
if python3 or type(_x) == unicode:
_x = _x.encode('utf-8')
length = len(_x)
buff.write(struct.pack('<I%ss'%length, length, _x))
_x = self
buff.write(_get_struct_3d().pack(_x.position3D.x, _x.position3D.y, _x.position3D.z))
except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self)))))
def deserialize_numpy(self, str, numpy):
"""
unpack serialized message in str into this message instance using numpy for array types
:param str: byte array of serialized message, ``str``
:param numpy: numpy python module
"""
try:
if self.header is None:
self.header = std_msgs.msg.Header()
if self.position3D is None:
self.position3D = geometry_msgs.msg.Point()
end = 0
_x = self
start = end
end += 12
(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _get_struct_3I().unpack(str[start:end])
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
start = end
end += length
if python3:
self.header.frame_id = str[start:end].decode('utf-8')
else:
self.header.frame_id = str[start:end]
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
start = end
end += length
if python3:
self.gestureId = str[start:end].decode('utf-8')
else:
self.gestureId = str[start:end]
_x = self
start = end
end += 24
(_x.position3D.x, _x.position3D.y, _x.position3D.z,) = _get_struct_3d().unpack(str[start:end])
return self
except struct.error as e:
raise genpy.DeserializationError(e) #most likely buffer underfill
_struct_I = genpy.struct_I
def _get_struct_I():
global _struct_I
return _struct_I
_struct_3I = None
def _get_struct_3I():
global _struct_3I
if _struct_3I is None:
_struct_3I = struct.Struct("<3I")
return _struct_3I
_struct_3d = None
def _get_struct_3d():
global _struct_3d
if _struct_3d is None:
_struct_3d = struct.Struct("<3d")
return _struct_3d
|
[
"mohamed@radiirobotics.com"
] |
mohamed@radiirobotics.com
|
422fd25c0af34230a5b3f5b6c60c72f3edeca6ac
|
98aee99dcb9a10f5aac6817388261d46015706a2
|
/app.py
|
f9ca46a33b70689729092c39216f55b96f63f4f2
|
[] |
no_license
|
anselmo-2010/Inventar-Flask-urok_47-
|
e403db991a56240e775f8de020f0a2bfc6b29085
|
83f6cf0f67c312c5bcda6625e617e3b3c7fad8bb
|
refs/heads/main
| 2023-06-11T18:42:46.761072
| 2021-07-02T14:34:04
| 2021-07-02T14:34:04
| 372,032,448
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 536
|
py
|
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/')
def homepage():
f = open('goods.txt', 'r', encoding='utf-8')
txt = f.readlines()
return render_template('index.html', goods = txt)
@app.route('/add/', methods=["POST"])
def add():
good = request.form["good"]
f = open('goods.txt', 'a+', encoding='utf-8')
f.write(good + "\n")
f.close()
return """
<h1>ะะฝะฒะตะฝัะฐัั ะฟะพะฟะพะปะฝะตะฝ</h1>
<a href='/'>ะะพะผะพะน</a>
"""
|
[
"you@example.com"
] |
you@example.com
|
bf156e026fa3ba1cc2248d87172ffa47bf378cbe
|
109a830aad476305f029274d75e28bec8b54f597
|
/mainapp/migrations/0002_somemodel.py
|
f1f20acd554c87122b21108f39125efa4850890d
|
[] |
no_license
|
Dapucla/EP
|
53b156088046abfd6833eba95dc4393ebeb93f4e
|
9368032b4b289b20ec1bdf0033d3fe199223d200
|
refs/heads/master
| 2023-06-19T08:02:55.984888
| 2021-07-11T22:52:24
| 2021-07-11T22:52:24
| 330,009,437
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 506
|
py
|
# Generated by Django 3.1.5 on 2021-01-06 10:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='SomeModel',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('image', models.ImageField(upload_to='')),
],
),
]
|
[
"dapcula08@yandex.ru"
] |
dapcula08@yandex.ru
|
63b0aea12c879c660f7baaf98db4273cad84fa67
|
a7cfae2264e31df40294ec4f1f0686f1450ee75a
|
/pikachuwechat/modules/core/analysisfriends.py
|
d070994ae2536c058c12926f6b97bb0c5a6b3f2e
|
[
"Apache-2.0"
] |
permissive
|
CharlesPikachu/pikachuwechat
|
5e991127ac2d30c802fc50cba63b4fc14367428a
|
056974fbe733843a9390172aba823c6474b2b857
|
refs/heads/master
| 2023-05-23T07:52:54.688351
| 2022-07-20T14:59:11
| 2022-07-20T14:59:11
| 169,863,170
| 45
| 8
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 3,316
|
py
|
'''
Function:
ๅพฎไฟกๅฅฝๅๅๆ
Author:
Charles
ๅพฎไฟกๅ
ฌไผๅท:
Charles็็ฎๅกไธ
'''
import os
import itchat
from ..utils import Logger, checkDir
from pyecharts.charts import Pie, Map
from pyecharts import options as opts
'''ๅพฎไฟกๅฅฝๅๅๆ'''
class AnalysisFriends():
func_name = 'ๅพฎไฟกๅฅฝๅๅๆ'
logger_handle = Logger(func_name+'.log')
def __init__(self, **kwargs):
self.options = kwargs
self.savedir = kwargs.get('savedir', 'results')
checkDir(self.savedir)
'''ๅค้จ่ฐ็จ่ฟ่ก'''
def run(self):
# ็ปๅฝ
try: itchat.auto_login(hotReload=True)
except: itchat.auto_login(hotReload=True, enableCmdQR=True)
# ่ทๅพๆๆๅฅฝๅไฟกๆฏ
AnalysisFriends.logger_handle.info('run getFriendsInfo...')
friends_info = self.getFriendsInfo()
# ๅๆๅฅฝๅๅฐๅๅๅธ
AnalysisFriends.logger_handle.info('run analysisArea...')
self.analysisArea(friends_info=friends_info)
# ๅๆๅฅฝๅๆงๅซๅๅธ
AnalysisFriends.logger_handle.info('run analysisSex...')
self.analysisSex(friends_info=friends_info)
'''ๅๆๅฅฝๅๅฐๅๅๅธ'''
def analysisArea(self, title='ๅๆๅฅฝๅๅฐๅๅๅธ', friends_info=None):
area_infos = {'ๆช็ฅ': 0}
for item in friends_info.get('province'):
if not item: area_infos['ๆช็ฅ'] += 1
else:
if item in area_infos: area_infos[item] += 1
else: area_infos[item] = 1
map_ = Map(init_opts=dict(theme='purple-passion', page_title=title))
map_.add(title, data_pair=tuple(zip(area_infos.keys(), area_infos.values())), maptype='china')
map_.set_global_opts(
title_opts=opts.TitleOpts(title=title),
visualmap_opts=opts.VisualMapOpts(max_=200),
)
map_.render(os.path.join(self.savedir, '%s.html' % title))
'''ๅๆๅฅฝๅๆงๅซๅๅธ'''
def analysisSex(self, title='ๅๆๅฅฝๅๆงๅซๅๅธ', friends_info=None):
sex_infos = {'็ท': 0, 'ๅฅณ': 0, 'ๆช็ฅ': 0}
for item in friends_info.get('sex'):
if item == 0: sex_infos['ๆช็ฅ'] += 1
elif item == 1: sex_infos['็ท'] += 1
elif item == 2: sex_infos['ๅฅณ'] += 1
pie = Pie(init_opts=dict(theme='westeros', page_title=title)).add(title, data_pair=tuple(zip(sex_infos.keys(), sex_infos.values())), rosetype='area')
pie.set_global_opts(title_opts=opts.TitleOpts(title=title))
pie.render(os.path.join(self.savedir, '%s.html' % title))
'''่ทๅพๆ้็ๅพฎไฟกๅฅฝๅไฟกๆฏ'''
def getFriendsInfo(self):
friends = itchat.get_friends()
friends_info = dict(
province=self.getKeyInfo(friends, "Province"),
city=self.getKeyInfo(friends, "City"),
nickname=self.getKeyInfo(friends, "Nickname"),
sex=self.getKeyInfo(friends, "Sex"),
signature=self.getKeyInfo(friends, "Signature"),
remarkname=self.getKeyInfo(friends, "RemarkName"),
pyquanpin=self.getKeyInfo(friends, "PYQuanPin")
)
return friends_info
'''ๆ นๆฎkeyๅผๅพๅฐๅฏนๅบ็ไฟกๆฏ'''
def getKeyInfo(self, friends, key):
return list(map(lambda friend: friend.get(key), friends))
|
[
"1159254961@qq.com"
] |
1159254961@qq.com
|
966f59944c7e49128f1479f400e957dbb60a6017
|
1b15b42087d58002432daff45fafb7eb4d0ca2d8
|
/733_flood_fill_4.py
|
321b4905637e4356c76b96e3ed8d65a27e4642e2
|
[] |
no_license
|
georgebzhang/Python_LeetCode
|
2b92be66880eaf4642a603897386622dc81fbaf3
|
c1703358ceeed67e3e85de05eda74447f31176a2
|
refs/heads/master
| 2020-04-26T01:38:33.750580
| 2019-06-21T21:51:13
| 2019-06-21T21:51:13
| 173,209,953
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,232
|
py
|
from collections import deque
class Solution(object):
def floodFill(self, image, sr, sc, newColor):
dirs = ((-1, 0), (1, 0), (0, -1), (0, 1))
def neighbors(i0, j0):
result = []
for di, dj in dirs:
i, j = i0 + di, j0 + dj
if 0 <= i < N and 0 <= j < M and image[j][i] == color:
result.append((i, j))
return result
def dfs(i, j):
if (i, j) in visited:
return
visited.add((i, j))
image[j][i] = newColor
for n in neighbors(i, j):
dfs(*n)
M, N = len(image), len(image[0])
color = image[sr][sc]
visited = set()
dfs(sc, sr)
return image
def print_image(self, image):
for row in image:
print(row)
def print_ans(self, ans):
self.print_image(ans)
def test(self):
image = [[1, 1, 1], [1, 1, 0], [1, 0, 1]]
sr = 1
sc = 1
newColor = 2
self.print_image(image)
print()
ans = self.floodFill(image, sr, sc, newColor)
self.print_ans(ans)
if __name__ == '__main__':
s = Solution()
s.test()
|
[
"georgebzhang5@gmail.com"
] |
georgebzhang5@gmail.com
|
873f1fc4b4c80fdde0de3cbc54f6538b5a07d1dc
|
acd41dc7e684eb2e58b6bef2b3e86950b8064945
|
/res/packages/scripts/scripts/client/gui/Scaleform/daapi/view/meta/SendInvitesWindowMeta.py
|
fa3db686b6a0c9f2e14f6b560eccda5cbbab4bca
|
[] |
no_license
|
webiumsk/WoT-0.9.18.0
|
e07acd08b33bfe7c73c910f5cb2a054a58a9beea
|
89979c1ad547f1a1bbb2189f5ee3b10685e9a216
|
refs/heads/master
| 2021-01-20T09:37:10.323406
| 2017-05-04T13:51:43
| 2017-05-04T13:51:43
| 90,268,530
| 0
| 0
| null | null | null | null |
WINDOWS-1250
|
Python
| false
| false
| 2,344
|
py
|
# 2017.05.04 15:24:37 Stลednรญ Evropa (letnรญ ฤas)
# Embedded file name: scripts/client/gui/Scaleform/daapi/view/meta/SendInvitesWindowMeta.py
from gui.Scaleform.framework.entities.abstract.AbstractWindowView import AbstractWindowView
class SendInvitesWindowMeta(AbstractWindowView):
"""
DO NOT MODIFY!
Generated with yaml.
__author__ = 'yaml_processor'
@extends AbstractWindowView
"""
def showError(self, value):
self._printOverrideError('showError')
def setOnlineFlag(self, value):
self._printOverrideError('setOnlineFlag')
def sendInvites(self, accountsToInvite, comment):
self._printOverrideError('sendInvites')
def getAllAvailableContacts(self):
self._printOverrideError('getAllAvailableContacts')
def as_onReceiveSendInvitesCooldownS(self, value):
if self._isDAAPIInited():
return self.flashObject.as_onReceiveSendInvitesCooldown(value)
def as_setDefaultOnlineFlagS(self, onlineFlag):
if self._isDAAPIInited():
return self.flashObject.as_setDefaultOnlineFlag(onlineFlag)
def as_setInvalidUserTagsS(self, tags):
"""
:param tags: Represented by Vector.<String> (AS)
"""
if self._isDAAPIInited():
return self.flashObject.as_setInvalidUserTags(tags)
def as_setWindowTitleS(self, value):
if self._isDAAPIInited():
return self.flashObject.as_setWindowTitle(value)
def as_onContactUpdatedS(self, contact):
if self._isDAAPIInited():
return self.flashObject.as_onContactUpdated(contact)
def as_onListStateChangedS(self, isEmpty):
if self._isDAAPIInited():
return self.flashObject.as_onListStateChanged(isEmpty)
def as_enableDescriptionS(self, isEnabled):
if self._isDAAPIInited():
return self.flashObject.as_enableDescription(isEnabled)
def as_enableMassSendS(self, isEnabled, addAllTooltip):
if self._isDAAPIInited():
return self.flashObject.as_enableMassSend(isEnabled, addAllTooltip)
# okay decompyling C:\Users\PC\wotmods\files\originals\res\packages\scripts\scripts\client\gui\Scaleform\daapi\view\meta\SendInvitesWindowMeta.pyc
# decompiled 1 files: 1 okay, 0 failed, 0 verify failed
# 2017.05.04 15:24:37 Stลednรญ Evropa (letnรญ ฤas)
|
[
"info@webium.sk"
] |
info@webium.sk
|
67e2f761958dc0dc7fd2fdf6192a2e8992a00d81
|
c9ddbdb5678ba6e1c5c7e64adf2802ca16df778c
|
/cases/pa3/sample/op_cmp_int-174.py
|
6a4dcd0a82e8a93715c662e6aaa1d9e59d55555d
|
[] |
no_license
|
Virtlink/ccbench-chocopy
|
c3f7f6af6349aff6503196f727ef89f210a1eac8
|
c7efae43bf32696ee2b2ee781bdfe4f7730dec3f
|
refs/heads/main
| 2023-04-07T15:07:12.464038
| 2022-02-03T15:42:39
| 2022-02-03T15:42:39
| 451,969,776
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 178
|
py
|
x:int = 42
y:int = 7
print(x == y)
print(x != y)
print(x < y)
print(x <= y)
print(x > y)
print(x >= y)
print(x == x)
print(x != x)
print(x < x)
print(x <= x)
print(x > x)
$Exp
|
[
"647530+Virtlink@users.noreply.github.com"
] |
647530+Virtlink@users.noreply.github.com
|
1251b3e38bcfdfb9156e1e5fb3bf21bd2970de42
|
a2d3f2787cd26f2bf90f30ba9516d1675a69f8be
|
/emission/tests/storageTests/TestUsefulQueries.py
|
3e66eb5cfee060b7bc51368d76aa66184a92430b
|
[
"BSD-3-Clause"
] |
permissive
|
njriasan/e-mission-server
|
318833ba06cb7f40ddb7b8d2ac3da4d049e7c846
|
23224ddcfd29f31c13f75d819d9ad8530aea052f
|
refs/heads/master
| 2020-05-02T11:02:00.528836
| 2019-03-27T19:21:31
| 2019-03-27T19:21:31
| 177,915,408
| 1
| 0
|
BSD-3-Clause
| 2019-03-27T04:01:32
| 2019-03-27T04:01:31
| null |
UTF-8
|
Python
| false
| false
| 4,761
|
py
|
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
# Standard imports
from future import standard_library
standard_library.install_aliases()
from builtins import *
import unittest
from datetime import datetime
import logging
# Our imports
from emission.core.get_database import get_section_db
import emission.storage.decorations.useful_queries as tauq
class UsefulQueriesTests(unittest.TestCase):
def setUp(self):
get_section_db().remove({"_id": "foo_1"})
get_section_db().remove({"_id": "foo_2"})
get_section_db().remove({"_id": "foo_3"})
def tearDown(self):
get_section_db().remove({"_id": "foo_1"})
get_section_db().remove({"_id": "foo_2"})
get_section_db().remove({"_id": "foo_3"})
self.assertEqual(get_section_db().find({'_id': 'foo_1'}).count(), 0)
self.assertEqual(get_section_db().find({'_id': 'foo_2'}).count(), 0)
self.assertEqual(get_section_db().find({'_id': 'foo_3'}).count(), 0)
def testGetAllSections(self):
get_section_db().insert({"_id": "foo_1", "trip_id": "bar"})
get_section_db().insert({"_id": "foo_2", "trip_id": "bar"})
get_section_db().insert({"_id": "foo_3", "trip_id": "baz"})
self.assertEqual(len(tauq.get_all_sections("foo_1")), 2)
def testGetAllSectionsForUserDay(self):
dt1 = datetime(2015, 1, 1, 1, 1, 1)
dt2 = datetime(2015, 1, 1, 2, 1, 1)
dt3 = datetime(2015, 1, 1, 3, 1, 1)
get_section_db().insert({"_id": "foo_1",
"type":"move",
"trip_id": "trip_1",
"section_id": 3,
"section_start_datetime": dt1,
"section_end_datetime": dt2})
get_section_db().insert({"_id": "foo_2",
"type":"place",
"trip_id": "trip_2",
"section_start_datetime": dt2,
"section_end_datetime": dt3})
get_section_db().insert({"_id": "foo_3",
"type": "move",
"trip_id": "trip_3",
"section_id": 0,
"section_start_datetime": dt3})
self.assertEqual(tauq.get_trip_before("foo_3")["_id"], "foo_1")
def testGetTripBefore(self):
dt1 = datetime(2015, 1, 1, 1, 1, 1)
dt2 = datetime(2015, 1, 1, 2, 1, 1)
dt3 = datetime(2015, 1, 2, 3, 1, 1)
get_section_db().insert({"_id": "foo_1",
"user_id": "test_user",
"type":"move",
"section_id": 3,
"section_start_datetime": dt1,
"section_end_datetime": dt2})
get_section_db().insert({"_id": "foo_2",
"user_id": "test_user",
"type":"place",
"section_start_datetime": dt2,
"section_end_datetime": dt3})
get_section_db().insert({"_id": "foo_3",
"user_id": "test_user",
"type": "move",
"section_id": 0,
"section_start_datetime": dt3})
secList = tauq.get_all_sections_for_user_day("test_user", 2015, 1, 1)
self.assertEqual(len(secList), 1)
self.assertEqual(secList[0]._id, "foo_1")
def testGetBounds(self):
dt1 = datetime(2015, 1, 1, 1, 1, 1)
dt2 = datetime(2015, 1, 1, 2, 1, 1)
dt3 = datetime(2015, 1, 2, 3, 1, 1)
sectionJsonList = []
sectionJsonList.append({"_id": "foo_1",
"user_id": "test_user",
"type":"move",
"section_id": 3,
"section_start_datetime": dt1,
"section_end_datetime": dt2,
"section_start_point": {"coordinates": [1,2], "type": "Point"},
"section_end_point": {"coordinates": [3,4], "type": "Point"}})
sectionJsonList.append({"_id": "foo_2",
"user_id": "test_user",
"type":"place",
"section_start_datetime": dt2,
"section_end_datetime": dt3,
"section_start_point": {"coordinates": [5,6], "type": "Point"},
"section_end_point": {"coordinates": [7,8], "type": "Point"}})
sectionJsonList.append({"_id": "foo_3",
"user_id": "test_user",
"type": "move",
"section_id": 0,
"section_start_datetime": dt3,
"section_start_point": {"coordinates": [9,10], "type": "Point"},
"section_end_point": {"coordinates": [11,12], "type": "Point"}})
bounds = tauq.get_bounds(sectionJsonList)
self.assertEqual(bounds[0].lat, 2)
self.assertEqual(bounds[0].lon, 1)
self.assertEqual(bounds[1].lat, 12)
self.assertEqual(bounds[1].lon, 11)
if __name__ == '__main__':
import emission.tests.common as etc
etc.configLogging()
unittest.main()
|
[
"shankari@eecs.berkeley.edu"
] |
shankari@eecs.berkeley.edu
|
566bc16353fd71873f7a98faf1a9959d315c2f00
|
118546c7bf7fe3063ed68e1c6270b33ed500c3c9
|
/thread/ex03.py
|
29313ac54622434d7c81d0b0c0d100abbc3d47d8
|
[] |
no_license
|
yoonah95/Python_practice
|
83b1070f1c95d57a9ea81d2ec3898521f98544f4
|
1e8fbded66e789ba77b3af5499520b8e8e01a6a1
|
refs/heads/master
| 2022-06-12T20:55:38.490142
| 2020-05-08T02:20:20
| 2020-05-08T02:20:20
| 256,125,044
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,060
|
py
|
import threading
import queue
class _Operation(threading.Thread):
def __init__(self,sem,*args,**kwds):
self.sem = sem
self.method = kwds.pop('target')
super().__init__(targer=self.wrappedTarget , args=args,kwds=kwds,daemon=True)
def wrappedTarget(self,*args,**kwds):
self.method()
if isinstance(self.sem,threading.Semaphore):
self.sem.release()
class OperationQueue:
def __init__(self,numberOfConcurrentTask=1):
self.queue = queue.Queue()
self.sem = threading.Semaphore(numberOfConcurrentTask)
def add(self,method,*args,**kwds):
task = _Operation(self.sem,method,*args,**kwds)
self.queue.put(task)
def mainloop(self):
while True:
t = self.queue.get()
self.sem.acquire()
t.start()
def start(self,run_async=False):
t = threading.Thread(target=self.mainloop,daemon=True)
t.start()
if not run_async:
t.join()
def foo(n):
for i in range(n):
print(i)
time.sleep(0.25)
q = OperationQueue(3)
q.start(True)
for _ in range(100):
q.add(foo,random.randrange(2,40))
time.sleep(40)
|
[
"yoon.a1@hanmail.net"
] |
yoon.a1@hanmail.net
|
02d41a37e03a917b39eb8dbf16d9c74ed1b6566d
|
7baa4fe99adf5d05f40d25a117adc7c022ab76f7
|
/examples/greedy_planner_example.py
|
d31d9e0f841a0f79cbfe9115b4d96586ce3a3972
|
[
"BSD-3-Clause"
] |
permissive
|
yonetaniryo/planning_python
|
2c75b2f462c18b027a1b65bffa4f18a946a5a29f
|
3d7d3c06cc577445a9b5b423f2907f5efa830a0f
|
refs/heads/master
| 2022-06-09T04:18:37.326931
| 2020-05-11T04:27:56
| 2020-05-11T04:27:56
| 262,938,335
| 0
| 0
|
BSD-3-Clause
| 2020-05-11T04:29:39
| 2020-05-11T04:29:38
| null |
UTF-8
|
Python
| false
| false
| 3,289
|
py
|
#!/usr/bin/env python
"""A minimal example that loads an environment from a png file, runs greedy planner and returns the path.
The search process and final path are rendered
Author: Mohak Bhardwaj
Date: 28 October, 2017
"""
import sys
sys.path.insert(0, "..")
import matplotlib.pyplot as plt
import time
from planning_python.environment_interface.env_2d import Env2D
from planning_python.state_lattices.common_lattice.xy_analytic_lattice import XYAnalyticLattice
from planning_python.cost_functions.cost_function import PathLengthNoAng, UnitCost
from planning_python.heuristic_functions.heuristic_function import EuclideanHeuristicNoAng, ManhattanHeuristicNoAng
from planning_python.data_structures.planning_problem import PlanningProblem
from planning_python.planners.greedy_planner import GreedyPlanner
import os
#Step1: Set some problem parameters
x_lims = [0, 200] # low(inclusive), upper(exclusive) extents of world in x-axis
y_lime = [0, 200] # low(inclusive), upper(exclusive) extents of world in y-axis
start = (0, 0) #start state(world coordinates)
goal = (199,199) #goal state(world coordinates)
visualize = True
#Step 2: Load environment from file
envfile = os.path.abspath("../../motion_planning_datasets/single_bugtrap/train/1.png")
env_params = {'x_lims': [0, 200], 'y_lims': [0, 200]}
e = Env2D()
e.initialize(envfile, env_params)
#Step 3: Create lattice to overlay on environment
lattice_params = dict()
lattice_params['x_lims'] = [0, 200] # Usefule to calculate number of cells in lattice
lattice_params['y_lims'] = [0, 200] # Useful to calculate number of cells in lattice
lattice_params['resolution'] = [1, 1] # Useful to calculate number of cells in lattice + conversion from discrete to continuous space and vice-versa
lattice_params['origin'] = start # Used for conversion from discrete to continuous and vice-versa.
lattice_params['rotation'] = 0 # Can rotate lattice with respect to world
lattice_params['connectivity'] = 'eight_connected' #Lattice connectivity (can be four or eight connected for xylattice)
lattice_params['path_resolution'] = 1 #Resolution for defining edges and doing collision checking (in meters)
l = XYAnalyticLattice(lattice_params)
#Step 4: Create cost and heuristic objects
cost_fn = PathLengthNoAng() #Penalize length of path
heuristic_fn = EuclideanHeuristicNoAng()
#(Additionally, you can precalculate edges and costs on lattice for speed-ups)
l.precalc_costs(cost_fn) #useful when lattice remains same across problems
#Step 5: Create a planning problem
prob_params = {'heuristic_weight': 1.0}
start_n = l.state_to_node(start)
goal_n = l.state_to_node(goal)
prob = PlanningProblem(prob_params)
prob.initialize(e, l, cost_fn, heuristic_fn, start_n, goal_n, visualize=visualize)
#Step 6: Create Planner object and ask it to solve the planning problem
planner = GreedyPlanner()
planner.initialize(prob)
path, path_cost, num_expansions, plan_time, came_from, cost_so_far, c_obs = planner.plan()
print('Path: ', path)
print('Path Cost: ', path_cost)
print('Number of Expansions: ', num_expansions)
print('Time taken: ', plan_time)
e.initialize_plot(start, goal)
e.plot_path(path, 'solid', 'red', 3)
plt.show()
|
[
"mohak.bhardwaj@gmail.com"
] |
mohak.bhardwaj@gmail.com
|
c42fa53fdbb01814855b836a54b9f8b8a3f3465c
|
3db5e39d9bbe1c86229a26e7d19e3ceb37f902e3
|
/Baekjoon/backtracking/6603_๋ก๋.py
|
8ac6e5866cc031be2dcc4ef32624dfba585f1c2b
|
[] |
no_license
|
sweetrain096/rain-s_python
|
5ca2fe5e7f97a681b6e75e64264687a723be1976
|
eb285eb50eeebfaa2b4a4d7816314e2073faab00
|
refs/heads/master
| 2021-07-19T16:06:01.389283
| 2020-05-29T14:56:16
| 2020-05-29T14:56:16
| 162,240,216
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,851
|
py
|
import sys
sys.stdin = open("6603_input.txt")
def dfs(start):
now = data[start]
visited[now] = 1
result.append(now)
# print(result)
if len(result) == 6:
print(' '.join(map(str, result)))
for i in range(start + 1, total + 1):
if not visited[data[i]]:
dfs(i)
visited[now] = 0
result.pop()
while True:
data = list(map(int, input().split()))
total = data[0]
if not total:
break
result = []
for start in range(1, total - 6 + 2):
visited = [0] * 50
dfs(start)
print()
# import sys
# sys.stdin = open("6603_input.txt")
#
# def dfs(start):
# start = data[start]
# visited[start] = 1
# result.append(start)
# # print(result)
# if len(result) == 6:
#
# print(result)
# for i in range(start + 1, total + 1):
# if not visited[data[i]]:
# dfs(i)
# visited[start] = 0
# result.pop()
#
#
# while True:
# data = list(map(int, input().split()))
# total = data[0]
# if not total:
# break
# print(data)
# result = []
# visited = [0] * 50
# for start in range(1, total - 6 + 2):
# dfs(start)
#
#
# # def dfs(start, visited):
# # now = data[start]
# # print(now)
# # if not visited[now]:
# # print(visited)
# # visited[now] = 1
# # result.append(now)
# #
# # if len(result) == 6:
# # print("result", result)
# # return
# #
# # for i in range(start, total + 1):
# # next = data[i]
# # if not visited[next] and len(result) < 6:
# #
# # # print(' '.join(map(str, result)))
# # print(result)
# #
# # dfs(i, visited)
# # t = result.pop()
# # visited[t] = 0
# # print("pop", t, result)
|
[
"gpfhddl09@gmail.com"
] |
gpfhddl09@gmail.com
|
ab2d48cc4933834d30c23e0ad66a2bad6a4eeaf9
|
11cb48f645b2a051a822e4a3a9dbdad87ff0f2f7
|
/meals/migrations/0005_auto_20200419_1329.py
|
368ff57c85ccb43d20b95a5fc929bbab8de69f96
|
[] |
no_license
|
arpan-shrestha/Django-resturent
|
54e3c77e6a23c780e4346e479683d97769cc80a5
|
30fa9a155b8377b16f95b7cade303b8dccf73bee
|
refs/heads/master
| 2022-07-16T14:53:16.032576
| 2020-05-19T11:29:21
| 2020-05-19T11:29:21
| 261,817,015
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 385
|
py
|
# Generated by Django 2.2.2 on 2020-04-19 13:29
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('meals', '0004_meals_category'),
]
operations = [
migrations.AlterModelOptions(
name='category',
options={'verbose_name': 'category', 'verbose_name_plural': ' categories'},
),
]
|
[
"root@localhost.localdomain"
] |
root@localhost.localdomain
|
64e7f9d24119950e166280edbb3d7e26fed07c9e
|
ec9aa6dd7405d5483e9ae09f700bb718f10cb4b5
|
/backend/home/migrations/0001_load_initial_data.py
|
74093808df7d90106c11cd7f5251a25ef8971ab4
|
[] |
no_license
|
crowdbotics-apps/whatsa-29124
|
0c41ef1e063ff30cb95496a56f3398128dd90c2a
|
d3defa32ca7ad10787f4db6384426c428b3af230
|
refs/heads/master
| 2023-06-28T04:04:21.757506
| 2021-07-24T20:30:05
| 2021-07-24T20:30:05
| 389,195,340
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 530
|
py
|
from django.db import migrations
def create_site(apps, schema_editor):
Site = apps.get_model("sites", "Site")
custom_domain = "whatsa-29124.botics.co"
site_params = {
"name": "Whatsa",
}
if custom_domain:
site_params["domain"] = custom_domain
Site.objects.update_or_create(defaults=site_params, id=1)
class Migration(migrations.Migration):
dependencies = [
("sites", "0002_alter_domain_unique"),
]
operations = [
migrations.RunPython(create_site),
]
|
[
"team@crowdbotics.com"
] |
team@crowdbotics.com
|
faac230832135bc3a080bd66e534c0ecf5539e37
|
bc233c24523f05708dd1e091dca817f9095e6bb5
|
/bitmovin_api_sdk/encoding/filters/crop/crop_api.py
|
eb68ce39513a7783814c8a4597f68194bf384fc7
|
[
"MIT"
] |
permissive
|
bitmovin/bitmovin-api-sdk-python
|
e3d6cf8eb8bdad62cb83ec77c0fc4950b06b9cdd
|
b0860c0b1be7747cf22ad060985504da625255eb
|
refs/heads/main
| 2023-09-01T15:41:03.628720
| 2023-08-30T10:52:13
| 2023-08-30T10:52:13
| 175,209,828
| 13
| 14
|
MIT
| 2021-04-29T12:30:31
| 2019-03-12T12:47:18
|
Python
|
UTF-8
|
Python
| false
| false
| 3,178
|
py
|
# coding: utf-8
from __future__ import absolute_import
from bitmovin_api_sdk.common import BaseApi, BitmovinApiLoggerBase
from bitmovin_api_sdk.common.poscheck import poscheck_except
from bitmovin_api_sdk.models.bitmovin_response import BitmovinResponse
from bitmovin_api_sdk.models.crop_filter import CropFilter
from bitmovin_api_sdk.models.response_envelope import ResponseEnvelope
from bitmovin_api_sdk.models.response_error import ResponseError
from bitmovin_api_sdk.encoding.filters.crop.customdata.customdata_api import CustomdataApi
from bitmovin_api_sdk.encoding.filters.crop.crop_filter_list_query_params import CropFilterListQueryParams
class CropApi(BaseApi):
@poscheck_except(2)
def __init__(self, api_key, tenant_org_id=None, base_url=None, logger=None):
# type: (str, str, str, BitmovinApiLoggerBase) -> None
super(CropApi, self).__init__(
api_key=api_key,
tenant_org_id=tenant_org_id,
base_url=base_url,
logger=logger
)
self.customdata = CustomdataApi(
api_key=api_key,
tenant_org_id=tenant_org_id,
base_url=base_url,
logger=logger
)
def create(self, crop_filter, **kwargs):
# type: (CropFilter, dict) -> CropFilter
"""Create Crop Filter
:param crop_filter: The Crop Filter to be created
:type crop_filter: CropFilter, required
:return: Crop details
:rtype: CropFilter
"""
return self.api_client.post(
'/encoding/filters/crop',
crop_filter,
type=CropFilter,
**kwargs
)
def delete(self, filter_id, **kwargs):
# type: (string_types, dict) -> BitmovinResponse
"""Delete Crop Filter
:param filter_id: Id of the Crop Filter.
:type filter_id: string_types, required
:return:
:rtype: BitmovinResponse
"""
return self.api_client.delete(
'/encoding/filters/crop/{filter_id}',
path_params={'filter_id': filter_id},
type=BitmovinResponse,
**kwargs
)
def get(self, filter_id, **kwargs):
# type: (string_types, dict) -> CropFilter
"""Crop Filter Details
:param filter_id: Id of the Crop Filter.
:type filter_id: string_types, required
:return: Crop details
:rtype: CropFilter
"""
return self.api_client.get(
'/encoding/filters/crop/{filter_id}',
path_params={'filter_id': filter_id},
type=CropFilter,
**kwargs
)
def list(self, query_params=None, **kwargs):
# type: (CropFilterListQueryParams, dict) -> CropFilter
"""List Crop Filters
:param query_params: Query parameters
:type query_params: CropFilterListQueryParams
:return: List of Crop Filters
:rtype: CropFilter
"""
return self.api_client.get(
'/encoding/filters/crop',
query_params=query_params,
pagination_response=True,
type=CropFilter,
**kwargs
)
|
[
"openapi@bitmovin.com"
] |
openapi@bitmovin.com
|
c76c48ac8d93e255cb9cc8603a3d286394a5bc90
|
f7a252b63b16a8f21d6921fd1f5c20075fec4cc9
|
/helpers/hadoop/wikipedia/words/merger.py
|
4d6c877c43697dbe39766419075eae9710f21503
|
[] |
no_license
|
zymITsky/twittomatic
|
5803b4c2db5f3c0ee1b65af86171b2c5f9b2c797
|
396c0800b594a85fbcb54e772b3bc60837ed3eab
|
refs/heads/master
| 2020-06-01T10:44:38.887254
| 2013-02-14T20:28:17
| 2013-02-14T20:28:17
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 736
|
py
|
import gzip
import heapq
import glob
def merge_files(inputfiles):
files = []
for filename in inputfiles:
files.append(iter(gzip.open(filename, 'r')))
iterator = iter(heapq.merge(*files))
line = iterator.next()
prevanchor, prevcounter = line.rstrip('\n').rsplit('\t', 1)
prevcounter = int(prevcounter)
for line in iterator:
anchor, counter = line.rstrip('\n').rsplit('\t', 1)
if anchor == prevanchor:
prevcounter += int(counter)
else:
print "%s\t%s" % (prevanchor, prevcounter)
prevanchor = anchor
prevcounter = int(counter)
print "%s\t%s" % (prevanchor, prevcounter)
files = glob.glob('*.tsv.gz')
merge_files(files)
|
[
"stack.box@gmail.com"
] |
stack.box@gmail.com
|
e9de1fbae42006866704b12710ee0caac1dc22ea
|
65a735524f36356c0d4870012df19b4ec655558b
|
/Coding the Matrix/matrix/hw0/hw0.py
|
c3a7336dcf67cb96888ca72baefab72715e6b9b9
|
[] |
no_license
|
zjsxzy/Courses
|
7047a871d6acb9748ef956bbdfd7570431c76e37
|
aacbd4c81cc3af2d0a74cc1d5c08931130e491fc
|
refs/heads/master
| 2020-03-30T07:13:54.812252
| 2013-10-29T02:16:40
| 2013-10-29T02:16:40
| 10,140,554
| 6
| 5
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 976
|
py
|
# Please fill out this stencil and submit using the provided submission script.
## Problem 1
def myFilter(L, num):
return [x for x in L if x % num != 0]
## Problem 2
def myLists(L):
return [list(range(1, x + 1)) for x in L]
## Problem 3
def myFunctionComposition(f, g):
return {k:g[v] for k, v in f.items()}
## Problem 4
# Please only enter your numerical solution.
complex_addition_a = 5 + 3j
complex_addition_b = 1j
complex_addition_c = -1 + 0.001j
complex_addition_d = 0.001 + 9j
## Problem 5
GF2_sum_1 = 1
GF2_sum_2 = 0
GF2_sum_3 = 0
## Problem 6
def mySum(L):
ret = 0
for x in L:
ret += x
return ret;
## Problem 7
def myProduct(L):
ret = 1
for x in L:
ret *= x
return ret;
## Problem 8
def myMin(L):
ret = L[0]
for x in L:
if x < ret:
ret = x
return ret
## Problem 9
def myConcat(L):
ret = ''
for x in L:
ret += x
return ret
## Problem 10
def myUnion(L):
ret = set()
for x in L:
ret |= x
return ret
|
[
"zjsxzy@gmail.com"
] |
zjsxzy@gmail.com
|
963ea31f26d0a3ff242a9c5e5d625f37f427e6ea
|
f445450ac693b466ca20b42f1ac82071d32dd991
|
/generated_tempdir_2019_09_15_163300/generated_part000711.py
|
ebaaff510bb65f65923cd0f3844acbce5b59094d
|
[] |
no_license
|
Upabjojr/rubi_generated
|
76e43cbafe70b4e1516fb761cabd9e5257691374
|
cd35e9e51722b04fb159ada3d5811d62a423e429
|
refs/heads/master
| 2020-07-25T17:26:19.227918
| 2019-09-15T15:41:48
| 2019-09-15T15:41:48
| 208,357,412
| 4
| 1
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,302
|
py
|
from sympy.abc import *
from matchpy.matching.many_to_one import CommutativeMatcher
from matchpy import *
from matchpy.utils import VariableWithCount
from collections import deque
from multiset import Multiset
from sympy.integrals.rubi.constraints import *
from sympy.integrals.rubi.utility_function import *
from sympy.integrals.rubi.rules.miscellaneous_integration import *
from sympy import *
class CommutativeMatcher112273(CommutativeMatcher):
_instance = None
patterns = {
0: (0, Multiset({}), [
(VariableWithCount('i2.3.3.1.0', 1, 1, None), Mul),
(VariableWithCount('i2.3.3.1.0_1', 1, 1, S(1)), Mul)
])
}
subjects = {}
subjects_by_id = {}
bipartite = BipartiteGraph()
associative = Mul
max_optional_count = 1
anonymous_patterns = set()
def __init__(self):
self.add_subject(None)
@staticmethod
def get():
if CommutativeMatcher112273._instance is None:
CommutativeMatcher112273._instance = CommutativeMatcher112273()
return CommutativeMatcher112273._instance
@staticmethod
def get_match_iter(subject):
subjects = deque([subject]) if subject is not None else deque()
subst0 = Substitution()
# State 112272
return
yield
from collections import deque
|
[
"franz.bonazzi@gmail.com"
] |
franz.bonazzi@gmail.com
|
1d71d22b4e7c4676ddbfd83f684686ed3e859183
|
8ab8a1c524030a95f2cba68a02ae036dd2c65d78
|
/lib/apps.py
|
5d96408738acefdd49b044567e9485b21cc466f5
|
[] |
no_license
|
marekventur/emfcamp-2018-app-library
|
2ffce3136c789c56bb45acecfb1ca33f4ac06a46
|
32e278d4c99936a70c28d23ae52270b7eff26a51
|
refs/heads/master
| 2020-03-22T16:40:46.762618
| 2018-07-16T22:04:42
| 2018-07-16T22:05:25
| 140,343,314
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 6,358
|
py
|
"""Model and Helpers for TiLDA apps and the App Library API"""
___license___ = "MIT"
___dependencies___ = ["http"]
import os
import ure
import http_client
import filesystem
import gc
ATTRIBUTE_MATCHER = ure.compile("^\s*###\s*([^:]*?)\s*:\s*(.*)\s*$") # Yeah, regex!
CATEGORY_ALL = "all"
CATEGORY_NOT_SET = "uncategorised"
class App:
"""Models an app and provides some helper functions"""
def __init__(self, folder_name, api_information = None):
self.folder_name = self.name = folder_name.lower()
self.user = EMF_USER
if USER_NAME_SEPARATOR in folder_name:
[self.user, self.name] = folder_name.split(USER_NAME_SEPARATOR, 1)
self.user = self.user.lower()
self.name = self.name.lower()
self._attributes = None # Load lazily
self.api_information = api_information
@property
def folder_path(self):
return "apps/" + self.folder_name
@property
def main_path(self):
return self.folder_path + "/main.py"
@property
def loadable(self):
return filesystem.is_file(self.main_path) and os.stat(self.main_path)[6] > 0
@property
def description(self):
"""either returns a local attribute or uses api_information"""
if self.api_information and "description" in self.api_information:
return self.api_information["description"]
return self.get_attribute("description") or ""
@property
def files(self):
"""returns a list of file dicts or returns False if the information is not available"""
if self.api_information and "files" in self.api_information:
return self.api_information["files"]
return False
@property
def category(self):
return self.get_attribute("Category", CATEGORY_NOT_SET).lower()
@property
def title(self):
return self.get_attribute("appname") or self.name
@property
def user_and_title(self):
if self.user == EMF_USER:
return self.name
else:
return "%s by %s" % (self.title, self.user)
def matches_category(self, category):
"""returns True if provided category matches the category of this app"""
category = category.lower()
return category == CATEGORY_ALL or category == self.category
@property
def attributes(self):
"""Returns all attribues of this app
The result is cached for the lifetime of this object
"""
if self._attributes == None:
self._attributes = {}
if self.loadable:
with open(self.main_path) as file:
for line in file:
match = ATTRIBUTE_MATCHER.match(line)
if match:
self._attributes[match.group(1).strip().lower()] = match.group(2).strip()
else:
break
return self._attributes
def get_attribute(self, attribute, default=None):
"""Returns the value of an attribute, or a specific default value if attribute is not found"""
attribute = attribute.lower() # attributes are case insensitive
if attribute in self.attributes:
return self.attributes[attribute]
else:
return default
def fetch_api_information(self):
"""Queries the API for information about this app, returns False if app is not publicly listed"""
with http_client.get("http://api.badge.emfcamp.org/api/app/%s/%s" % (self.user, self.name)) as response:
if response.status == 404:
return False
self.api_information = response.raise_for_status().json()
return self.api_information
def __str__(self):
return self.user_and_title
def __repr__(self):
return "<App %s>" % (self.folder_name)
def app_by_name_and_user(name, user):
"""Returns an user object"""
if user.lower() == EMF_USER:
return App(name)
else:
return App(user + USER_NAME_SEPARATOR + name)
def app_by_api_response(response):
if response["user"].lower() == EMF_USER:
return App(response["name"], response)
else:
return App(response["user"] + USER_NAME_SEPARATOR + response["name"], response)
def get_local_apps(category=CATEGORY_ALL):
"""Returns a list of apps that can be found in the apps folder"""
apps = [App(folder_name) for folder_name in os.listdir("apps") if filesystem.is_dir("apps/" + folder_name)]
return [app for app in apps if app.matches_category(category)]
_public_apps_cache = None
def fetch_public_app_api_information(uncached=False):
"""Returns a dict category => list of apps
Uses cached version unless the uncached parameter is set
"""
global _public_apps_cache
if not _public_apps_cache or uncached:
response = {}
for category, apps in http_client.get("http://api.badge.emfcamp.org/api/apps").raise_for_status().json().items():
response[category] = [app_by_api_response(app) for app in apps]
_public_apps_cache = response
return _public_apps_cache
def get_public_app_categories(uncached=False):
"""Returns a list of all categories used on the app library"""
return list(fetch_public_app_api_information(uncached).keys())
def get_public_apps(category=CATEGORY_ALL, uncached=False):
"""Returns a list of all public apps in one category"""
category = category.lower()
api_information = fetch_public_app_api_information(uncached)
return api_information[category] if category in api_information else []
_category_cache = None
def get_local_app_categories(uncached=False):
"""Returns a list of all app categories the user's apps are currently using
Uses cached version unless the uncached parameter is set
"""
global _category_cache
if not _category_cache or uncached:
_category_cache = ["all"]
for app in get_local_apps():
if app.category not in _category_cache:
_category_cache.append(app.category)
return _category_cache
def empty_local_app_cache():
"""If you're tight on memory you can clean up the local cache"""
global _public_apps_cache, _category_cache
_public_apps_cache = None
_category_cache = None
gc.collect()
|
[
"marekventur@gmail.com"
] |
marekventur@gmail.com
|
581f5adec9da3ee40c34877b24662132f1a72437
|
35dbd536a17d7127a1dd1c70a2903ea0a94a84c2
|
/fixtures/schema_validation.py
|
6b0ead9186f4e6aa218c3c747c04b35ab07587e3
|
[
"Apache-2.0",
"BUSL-1.1"
] |
permissive
|
nagyist/sentry
|
efb3ef642bd0431990ca08c8296217dabf86a3bf
|
d9dd4f382f96b5c4576b64cbf015db651556c18b
|
refs/heads/master
| 2023-09-04T02:55:37.223029
| 2023-01-09T15:09:44
| 2023-01-09T15:09:44
| 48,165,782
| 0
| 0
|
BSD-3-Clause
| 2022-12-16T19:13:54
| 2015-12-17T09:42:42
|
Python
|
UTF-8
|
Python
| false
| false
| 505
|
py
|
import pytest
from jsonschema import ValidationError
def invalid_schema(func):
def inner(self, *args, **kwargs):
with pytest.raises(ValidationError):
func(self)
return inner
def invalid_schema_with_error_message(message):
def decorator(func):
def inner(self, *args, **kwargs):
with pytest.raises(ValidationError) as excinfo:
func(self)
assert excinfo.value.message == message
return inner
return decorator
|
[
"noreply@github.com"
] |
nagyist.noreply@github.com
|
50896b220232ff3cad259b8616dcaf5801e1c0fe
|
3a9f2b3d79cf214704829427ee280f4b49dca70a
|
/saigon/rat/RuckusAutoTest/tests/zd/CB_ZD_Verify_AAA_Server_GUI_CLI_Get.py
|
edf805d0ccb40058c8caa5ef9eb27ed5e1fc115a
|
[] |
no_license
|
jichunwei/MyGitHub-1
|
ae0c1461fe0a337ef459da7c0d24d4cf8d4a4791
|
f826fc89a030c6c4e08052d2d43af0b1b4b410e3
|
refs/heads/master
| 2021-01-21T10:19:22.900905
| 2016-08-20T03:34:52
| 2016-08-20T03:34:52
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,338
|
py
|
# Copyright (C) 2011 Ruckus Wireless, Inc. All rights reserved.
# Please make sure the following module docstring is accurate since it will be used in report generation.
"""
Description:
@author: Cherry Cheng
@contact: cherry.cheng@ruckuswireless.com
@since: Feb 2012
Prerequisite (Assumptions about the state of the test bed/DUT):
1. Build under test is loaded on the AP and Zone Director
Required components:
Test parameters:
Test procedure:
1. Config:
- initialize test parameters
2. Test:
- Compare aaa servers between GUI get and CLI get
3. Cleanup:
- N/A
Result type: PASS/FAIL
Results: PASS: Data between gui get and cli get are same
FAIL: If any item is incorrect
Messages: If FAIL the test script returns a message related to the criterion that is not satisfied
"""
import logging
from RuckusAutoTest.models import Test
from RuckusAutoTest.components.lib.zdcli import aaa_servers as cas
class CB_ZD_Verify_AAA_Server_GUI_CLI_Get(Test):
required_components = []
parameters_description = {}
def config(self, conf):
self._initTestParameters(conf)
def test(self):
logging.debug("GUI: %s" % self.gui_get_server_list)
logging.debug("CLI: %s" % self.cli_get_server_list)
self._verify_server_gui_cli_get()
if self.errmsg:
return self.returnResult('FAIL', self.errmsg)
else:
self.passmsg = "The servers information are same between GUI get and CLI get"
return self.returnResult('PASS', self.passmsg)
def cleanup(self):
pass
def _initTestParameters(self, conf):
self.gui_get_server_list = self.carrierbag['zdgui_server_info_list']
self.cli_get_server_list = self.carrierbag['zdcli_server_info_list']
self.errmsg = ''
self.passmsg = ''
def _verify_server_gui_cli_get(self):
logging.info('Verify the AAA server settings between GUI get and CLI get')
try:
err_msg = cas.verify_server_cfg_gui_cli_get(self.gui_get_server_list, self.cli_get_server_list)
if err_msg:
self.errmsg = err_msg
except Exception, ex:
self.errmsg = ex.message
|
[
"tan@xx.com"
] |
tan@xx.com
|
434f7560833bf09a40483a71d5430a62a3834174
|
95f3e72dfdd6e7194c8cdad6529f891141d1cc68
|
/pyatv/mrp/protobuf/SendCommandResultMessage_pb2.pyi
|
f1d7710eb0bdb3adb65d89fb6d8f556b29319296
|
[
"MIT"
] |
permissive
|
Lee-View/pyatv
|
87939b2ce7c2d5d383090c64c4f0f15b03d040cb
|
5f46dacccea8e107d0407c95432eda611980ef81
|
refs/heads/master
| 2021-01-02T11:19:36.315363
| 2020-02-10T18:36:16
| 2020-02-10T19:02:39
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,477
|
pyi
|
# @generated by generate_proto_mypy_stubs.py. Do not edit!
import sys
from google.protobuf.descriptor import (
Descriptor as google___protobuf___descriptor___Descriptor,
FieldDescriptor as google___protobuf___descriptor___FieldDescriptor,
)
from google.protobuf.internal.containers import (
RepeatedScalarFieldContainer as google___protobuf___internal___containers___RepeatedScalarFieldContainer,
)
from google.protobuf.message import (
Message as google___protobuf___message___Message,
)
from typing import (
Iterable as typing___Iterable,
Optional as typing___Optional,
)
from typing_extensions import (
Literal as typing_extensions___Literal,
)
builtin___bool = bool
builtin___bytes = bytes
builtin___float = float
builtin___int = int
class SendCommandResultMessage(google___protobuf___message___Message):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
errorCode = ... # type: builtin___int
handlerReturnStatus = ... # type: builtin___int
handlerReturnStatusDatas = ... # type: google___protobuf___internal___containers___RepeatedScalarFieldContainer[builtin___bytes]
def __init__(self,
*,
errorCode : typing___Optional[builtin___int] = None,
handlerReturnStatus : typing___Optional[builtin___int] = None,
handlerReturnStatusDatas : typing___Optional[typing___Iterable[builtin___bytes]] = None,
) -> None: ...
@classmethod
def FromString(cls, s: builtin___bytes) -> SendCommandResultMessage: ...
def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ...
def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ...
if sys.version_info >= (3,):
def HasField(self, field_name: typing_extensions___Literal[u"errorCode",u"handlerReturnStatus"]) -> builtin___bool: ...
def ClearField(self, field_name: typing_extensions___Literal[u"errorCode",u"handlerReturnStatus",u"handlerReturnStatusDatas"]) -> None: ...
else:
def HasField(self, field_name: typing_extensions___Literal[u"errorCode",b"errorCode",u"handlerReturnStatus",b"handlerReturnStatus"]) -> builtin___bool: ...
def ClearField(self, field_name: typing_extensions___Literal[u"errorCode",b"errorCode",u"handlerReturnStatus",b"handlerReturnStatus",u"handlerReturnStatusDatas",b"handlerReturnStatusDatas"]) -> None: ...
sendCommandResultMessage = ... # type: google___protobuf___descriptor___FieldDescriptor
|
[
"pierre.staahl@gmail.com"
] |
pierre.staahl@gmail.com
|
ecb7ed4701df3ff2fdfa90258ae280604ab871d2
|
9c7e75720740422044747387907b2678360b7241
|
/setup.py
|
302fc4bf2efd1912fe8516e65300143060032d8b
|
[
"MIT"
] |
permissive
|
sourabhtkd/django-log-viewer
|
cc84c861ff9f10e3d6c498ebce8c93ef5c10b2cf
|
a8216d3572d5209a50175a9004a4f59fe2227492
|
refs/heads/master
| 2023-06-12T12:41:17.348747
| 2021-07-07T01:18:06
| 2021-07-07T01:18:06
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,572
|
py
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import (setup, find_packages)
__version__ = '1.1.3'
setup(
name='django-log-viewer',
version=__version__,
packages=find_packages(exclude=["*demo"]),
include_package_data=True,
zip_safe=False,
description='Django log viewer',
url='https://github.com/agusmakmun/django-log-viewer',
download_url='https://github.com/agusmakmun/django-log-viewer/tarball/v%s' % __version__,
keywords=['django log viewer'],
long_description=open('README.rst').read(),
license='MIT',
author='Agus Makmun (Summon Agus)',
author_email='summon.agus@gmail.com',
classifiers=[
'Framework :: Django',
'Framework :: Django :: 1.8',
'Framework :: Django :: 1.9',
'Framework :: Django :: 1.10',
'Framework :: Django :: 1.11',
'Framework :: Django :: 2.0',
'Framework :: Django :: 3.0',
'Framework :: Django :: 3.1',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Development Status :: 5 - Production/Stable',
'Topic :: Software Development :: Libraries :: Python Modules',
'License :: OSI Approved :: MIT License',
'Environment :: Web Environment',
]
)
|
[
"summon.agus@gmail.com"
] |
summon.agus@gmail.com
|
0be80f1a5029ac315fad63e0b82ca6c1af7b3388
|
3b479163504e51abdd08596f13abe40d0f84c8e6
|
/ISSUE-11/SOLUTION-5/obstacles.py
|
1cfadd86988aec43ee6811a3b29b2b626d8707de
|
[] |
no_license
|
kantal/WPC
|
c864bf7f1a0ce63aef264309dfb9fce7587895bd
|
46648436ee2dac2b727a1382c4e13a9a0ccb8bdf
|
refs/heads/master
| 2021-06-10T14:08:57.441613
| 2021-02-16T12:00:11
| 2021-02-16T12:00:11
| 16,383,034
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 5,141
|
py
|
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
'''
2013-06-02 by kantal59
License: LGPL
OLIMEX WPC#11:
Letโs have a maze with size X x Y where X and Y are integer (3..100) .
The maze is defined with strings, where in the string โWโ is wall, โ@โ is obstacle and โ โ is air.
Make code which finds the largest by area connected obstacles in the maze.
Python3 required.
Counting the '@' which are neighbours. Input will be read from file, which must contain SPACES instead of TABS, or using test data.
The main algorithm consist of 8 lines of code, the rest is just glitter.
For graphics demo (with fixed canvas size), the 'GUI' must be set to True. The 'tkinter' module required.
'''
#GUI= False
GUI= True
from os import sys
#---------------------------------
# THE ALGORITHM
#---------------------------------
def neighbours( obi, obstacles ):
''' The algorithm.
'''
yield obi
nb= [ (x,y) for (x,y) in obstacles if (x,y) in [ (obi[0]+i, obi[1]+j) for i in range(-1,2) for j in range(-1,2) ] ]
for p in nb:
obstacles.remove(p)
for p in nb:
# neighbours( p, obstacles) <-- yielded values of recursive generator must be propagated explicitly
for others in neighbours( p, obstacles):
yield others
#----------------------------------
# DATA READING
#----------------------------------
def load_data( fname, obstacles):
''' Input
'''
row=0
fd=open(fname,'r')
for line in fd:
pos= line.find('@')
while pos!=-1:
obstacles.append( (row,pos) )
#---- graphics begins
if GUI:
chgcolor( (row,pos), "red")
#---- graphics ends
pos= line.find('@',pos+1)
#---- graphics begins
if GUI:
line=line.upper()
pos= line.find('W')
while pos!=-1:
chgcolor( (row,pos), "black")
pos= line.find('W',pos+1)
#---- graphics ends
row+=1
fd.close()
#----------------------------------
# GRAPHICS
#----------------------------------
if GUI:
from tkinter import *
from tkinter import ttk
scell=10; xmaze=300; ymaze=300; title='OLIMEX WPC#11'
it=None
def chgcolor( t, color):
oid= can.find_closest( t[1]*scell, t[0]*scell)
can.itemconfigure( oid, fill=color )
def step( points,bls,mx):
global it
if it==None:
it=iter(points)
try:
chgcolor( next(it),"green")
win.after( 500, step, points,bls,mx)
except StopIteration:
win.title( title+" ---> the largest block size: {0}".format(mx))
for b in bls:
if len(b)==mx:
for p in b:
chgcolor( p,"yellow")
win= Tk()
hsc = ttk.Scrollbar(win, orient=HORIZONTAL)
vsc = ttk.Scrollbar(win, orient=VERTICAL)
can= Canvas( win, width=500, height=400, scrollregion=(0, 0, scell*ymaze, scell*xmaze), bg='gray', yscrollcommand=vsc.set, xscrollcommand=hsc.set )
hsc['command'] = can.xview
vsc['command'] = can.yview
can.grid(column=0, row=0, sticky=(N,W,E,S))
hsc.grid(column=0, row=1, sticky=(W,E))
vsc.grid(column=1, row=0, sticky=(N,S))
ttk.Sizegrip(win).grid(column=1, row=1, sticky=(S,E))
win.grid_columnconfigure(0, weight=1)
win.grid_rowconfigure(0, weight=1)
for i in range(0,xmaze):
x=i*scell
for j in range(0,ymaze):
y=j*scell
can.create_rectangle( x,y, x+scell, y+scell)
win.title(title)
#----------------------------------
# TESTING
#----------------------------------
def main():
''' Test
'''
#--- Input
stones=[]
if len(sys.argv)!=2:
print("\nUsage: $> obstacles.py maze_file\n- using test data:\n")
stones= [ (3,3),(3,4),(4,2),(4,3),(5,7),(6,1),(6,6),(6,7) ]
#stones= [ (3,3),(3,4),(4,2),(4,3),(5,7),(6,1),(6,6),(6,7), (4,4),(4,5),(4,6),(3,6) ]
#---- graphics begins
if GUI:
for p in stones:
chgcolor( p, "red")
#---- graphics ends
else:
print("- using the file: {0}".format(sys.argv[1]))
load_data( sys.argv[1], stones)
#--- Calculation
blocks=[]
while stones:
p=stones.pop()
blocks.append( [ a for a in neighbours( p, stones) ] )
#--- Output
l=0
for a in blocks:
if len(a) > l:
l=len(a)
print("size: {0} -->{1}".format( len(a),a))
print("The largest size: {0}".format(l) )
#---- graphics begins
if GUI:
pnts=[ p for bl in blocks for p in bl ]
win.after( 1000, step, pnts, blocks, l)
#---- graphics ends
# LET'S GO !
if GUI:
#---- graphics begins
win.after( 100, main)
win.mainloop()
#---- graphics ends
else:
main()
|
[
"usunov@olimex.com"
] |
usunov@olimex.com
|
1a9931e21fe1e127a78ef5b4276c981c27471124
|
16a5c9c9f0d7519a6808efc61b592b4b614102cf
|
/Python/70.py
|
966783c4a0677185ef2fd95c25677aa959c88acf
|
[] |
no_license
|
kevin851066/Leetcode
|
c1d86b2e028526231b80c6d4fb6d0be7ae8d39e5
|
885a9af8a7bee3c228c7ae4e295dca810bd91d01
|
refs/heads/main
| 2023-08-10T16:50:12.426440
| 2021-09-28T15:23:26
| 2021-09-28T15:23:26
| 336,277,469
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 228
|
py
|
class Solution:
def climbStairs(self, n):
'''
:type: n: int
:rtype: int
'''
arr = [1, 2]
for i in range(2, n):
arr.append(arr[i-1]+arr[i-2])
return arr[n-1]
|
[
"kevin851066@gmail.com"
] |
kevin851066@gmail.com
|
b425bac67bd61149de100ef3f07563c01ca8f0b6
|
e0fbc96bec9e83bc3fc3482e432bd2c6b6ad05a6
|
/MRPT/vtz/monoxides/FeO/mrpt.py
|
9647bda9cf436383cf636a27b17a5e16e9757669
|
[
"MIT"
] |
permissive
|
mussard/share_data_benchmark
|
fe2cbd95879e069be2475d39b191de4f04e140ee
|
c02bfa4017b9008800cabe47d7c7959f82c26060
|
refs/heads/master
| 2020-03-11T21:25:00.264437
| 2019-04-29T00:28:13
| 2019-04-29T00:28:13
| 130,264,292
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,958
|
py
|
import json
from pyscf import gto,scf,mcscf, fci, lo, ci, cc
from pyscf.scf import ROHF, UHF,ROKS
import numpy as np
import pandas as pd
# THIS IS WERE IT STARTS ====================================
df=json.load(open("../../../trail.json"))
spins={'ScO':1, 'TiO':2, 'VO':3, 'CrO':4, 'MnO':5, 'FeO':4, 'CuO':1}
nd={'Sc':(1,0), 'Ti':(2,0), 'V':(3,0), 'Cr':(5,0), 'Mn':(5,0), 'Fe':(5,1), 'Cu':(5,4)}
cas={'Sc':3, 'Ti':4, 'V':5, 'Cr':6, 'Mn':7, 'Fe':8, 'Cu':11}
re={'ScO':1.668, 'TiO':1.623, 'VO':1.591, 'CrO':1.621, 'MnO':1.648, 'FeO':1.616, 'CuO':1.725}
datacsv={}
for nm in ['basis','charge','method','molecule','pseudopotential',
'totalenergy','totalenergy-stocherr','totalenergy-syserr']:
datacsv[nm]=[]
basis='vtz'
element='Fe'
mol=gto.Mole()
mol.ecp={}
mol.basis={}
for el in [element,'O']:
mol.ecp[el]=gto.basis.parse_ecp(df[el]['ecp'])
mol.basis[el]=gto.basis.parse(df[el][basis])
mol.charge=0
mol.spin=spins[element+'O']
mol.build(atom="%s 0. 0. 0.; O 0. 0. %g"%(element,re[element+'O']),verbose=4)
m=ROHF(mol)
m.level_shift=1000.0
dm=m.from_chk("../../../../HF/monoxides/"+element+basis+"0.chk")
hf=m.kernel(dm)
m.analyze()
from pyscf.shciscf import shci
mc = shci.SHCISCF(m, 9, 4+cas[element])
#mc.fcisolver.conv_tol = 1e-14
mc.fcisolver.mpiprefix="srun -n20"
mc.fcisolver.num_thrds=12
mc.verbose = 4
cas=mc.kernel()[0]
from pyscf.icmpspt import icmpspt
pt=icmpspt.icmpspt(mc,rdmM=500, PTM=1000,\
pttype="MRLCC",\
third_order=True,\
fully_ic=True,\
do_dm4=True)
datacsv['basis'].append(basis)
datacsv['charge'].append(0)
datacsv['method'].append('MRPT')
datacsv['molecule'].append(element)
datacsv['pseudopotential'].append('trail')
datacsv['totalenergy'].append(cas+pt)
datacsv['totalenergy-stocherr'].append(0.0)
datacsv['totalenergy-syserr'].append(0.0)
pd.DataFrame(datacsv).to_csv(element+".csv",index=False)
|
[
"bastien.mussard@colorado.edu"
] |
bastien.mussard@colorado.edu
|
d4875149298a8f42184376266bdf807f665ffb6b
|
19dedf819f54bf905b2f68053ea75a654578b69e
|
/manimlib/mobject/number_line.py
|
40577194a33b901704314043b50494077895ad7f
|
[
"MIT"
] |
permissive
|
gear/ganim
|
784eb88cdbc7e0dfdd1123344bb5c73a170d1a56
|
6a84bbc37580b79de28fe3f25c314f5f828d9705
|
refs/heads/master
| 2022-11-29T23:39:45.363480
| 2019-12-20T07:46:23
| 2019-12-20T07:46:23
| 229,211,899
| 0
| 1
|
MIT
| 2022-11-22T02:58:38
| 2019-12-20T07:20:07
|
Python
|
UTF-8
|
Python
| false
| false
| 6,218
|
py
|
import operator as op
from manimlib.constants import *
from manimlib.mobject.geometry import Line
from manimlib.mobject.numbers import DecimalNumber
from manimlib.mobject.types.vectorized_mobject import VGroup
from manimlib.utils.bezier import interpolate
from manimlib.utils.config_ops import digest_config
from manimlib.utils.config_ops import merge_dicts_recursively
from manimlib.utils.simple_functions import fdiv
from manimlib.utils.space_ops import normalize
class NumberLine(Line):
CONFIG = {
"color": LIGHT_GREY,
"x_min": -FRAME_X_RADIUS,
"x_max": FRAME_X_RADIUS,
"unit_size": 1,
"include_ticks": True,
"tick_size": 0.1,
"tick_frequency": 1,
# Defaults to value near x_min s.t. 0 is a tick
# TODO, rename this
"leftmost_tick": None,
# Change name
"numbers_with_elongated_ticks": [0],
"include_numbers": False,
"numbers_to_show": None,
"longer_tick_multiple": 2,
"number_at_center": 0,
"number_scale_val": 0.75,
"label_direction": DOWN,
"line_to_number_buff": MED_SMALL_BUFF,
"include_tip": False,
"tip_width": 0.25,
"tip_height": 0.25,
"decimal_number_config": {
"num_decimal_places": 0,
},
"exclude_zero_from_default_numbers": False,
}
def __init__(self, **kwargs):
digest_config(self, kwargs)
start = self.unit_size * self.x_min * RIGHT
end = self.unit_size * self.x_max * RIGHT
Line.__init__(self, start, end, **kwargs)
self.shift(-self.number_to_point(self.number_at_center))
self.init_leftmost_tick()
if self.include_tip:
self.add_tip()
if self.include_ticks:
self.add_tick_marks()
if self.include_numbers:
self.add_numbers()
def init_leftmost_tick(self):
if self.leftmost_tick is None:
self.leftmost_tick = op.mul(
self.tick_frequency,
np.ceil(self.x_min / self.tick_frequency)
)
def add_tick_marks(self):
tick_size = self.tick_size
self.tick_marks = VGroup(*[
self.get_tick(x, tick_size)
for x in self.get_tick_numbers()
])
big_tick_size = tick_size * self.longer_tick_multiple
self.big_tick_marks = VGroup(*[
self.get_tick(x, big_tick_size)
for x in self.numbers_with_elongated_ticks
])
self.add(
self.tick_marks,
self.big_tick_marks,
)
def get_tick(self, x, size=None):
if size is None:
size = self.tick_size
result = Line(size * DOWN, size * UP)
result.rotate(self.get_angle())
result.move_to(self.number_to_point(x))
result.match_style(self)
return result
def get_tick_marks(self):
return VGroup(
*self.tick_marks,
*self.big_tick_marks,
)
def get_tick_numbers(self):
u = -1 if self.include_tip else 1
return np.arange(
self.leftmost_tick,
self.x_max + u * self.tick_frequency / 2,
self.tick_frequency
)
def number_to_point(self, number):
alpha = float(number - self.x_min) / (self.x_max - self.x_min)
return interpolate(
self.get_start(), self.get_end(), alpha
)
def point_to_number(self, point):
start_point, end_point = self.get_start_and_end()
full_vect = end_point - start_point
unit_vect = normalize(full_vect)
def distance_from_start(p):
return np.dot(p - start_point, unit_vect)
proportion = fdiv(
distance_from_start(point),
distance_from_start(end_point)
)
return interpolate(self.x_min, self.x_max, proportion)
def n2p(self, number):
"""Abbreviation for number_to_point"""
return self.number_to_point(number)
def p2n(self, point):
"""Abbreviation for point_to_number"""
return self.point_to_number(point)
def get_unit_size(self):
return (self.x_max - self.x_min) / self.get_length()
def default_numbers_to_display(self):
if self.numbers_to_show is not None:
return self.numbers_to_show
numbers = np.arange(
np.floor(self.leftmost_tick),
np.ceil(self.x_max),
)
if self.exclude_zero_from_default_numbers:
numbers = numbers[numbers != 0]
return numbers
def get_number_mobject(self, number,
number_config=None,
scale_val=None,
direction=None,
buff=None):
number_config = merge_dicts_recursively(
self.decimal_number_config,
number_config or {},
)
if scale_val is None:
scale_val = self.number_scale_val
if direction is None:
direction = self.label_direction
buff = buff or self.line_to_number_buff
num_mob = DecimalNumber(number, **number_config)
num_mob.scale(scale_val)
num_mob.next_to(
self.number_to_point(number),
direction=direction,
buff=buff
)
return num_mob
def get_number_mobjects(self, *numbers, **kwargs):
if len(numbers) == 0:
numbers = self.default_numbers_to_display()
return VGroup(*[
self.get_number_mobject(number, **kwargs)
for number in numbers
])
def get_labels(self):
return self.get_number_mobjects()
def add_numbers(self, *numbers, **kwargs):
self.numbers = self.get_number_mobjects(
*numbers, **kwargs
)
self.add(self.numbers)
return self
class UnitInterval(NumberLine):
CONFIG = {
"x_min": 0,
"x_max": 1,
"unit_size": 6,
"tick_frequency": 0.1,
"numbers_with_elongated_ticks": [0, 1],
"number_at_center": 0.5,
"decimal_number_config": {
"num_decimal_places": 1,
}
}
|
[
"hoangnt.titech@gmail.com"
] |
hoangnt.titech@gmail.com
|
38e4789e280a8928eeebee517516c384dbfba205
|
0b41847069aa825496ba80bb2d776cdba7cf4bc1
|
/src/face++.py
|
5630b0edd20d049360ae037b5b6a7e1334fa5b73
|
[] |
no_license
|
josephding23/Facial
|
b30ba17cf8138b8b7631080983d770ce01339d67
|
9ce4332ec84a0d1edd8256014baacb57b38a432b
|
refs/heads/master
| 2021-10-28T04:49:54.055836
| 2019-04-22T06:52:03
| 2019-04-22T06:52:03
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,035
|
py
|
# -*- coding: utf-8 -*-
import urllib.request
import urllib.error
import time
import json
http_url = 'https://api-cn.faceplusplus.com/facepp/v3/detect'
key = "JiR6-u4F8zPb63yuIRi3x7q8V_3kGd0M"
secret = "L81Va5ynggdIrrs107c9h9WnqW7I1YDs"
filepath = r"E:/Fotografica/92414d2ccbe975e049634c084f0d6.jpg"
boundary = '----------%s' % hex(int(time.time() * 1000))
data = []
data.append('--%s' % boundary)
data.append('Content-Disposition: form-data; name="%s"\r\n' % 'api_key')
data.append(key)
data.append('--%s' % boundary)
data.append('Content-Disposition: form-data; name="%s"\r\n' % 'api_secret')
data.append(secret)
data.append('--%s' % boundary)
fr = open(filepath, 'rb')
data.append('Content-Disposition: form-data; name="%s"; filename=" "' % 'image_file')
data.append('Content-Type: %s\r\n' % 'application/octet-stream')
data.append(fr.read())
fr.close()
data.append('--%s' % boundary)
data.append('Content-Disposition: form-data; name="%s"\r\n' % 'return_landmark')
data.append('1')
data.append('--%s' % boundary)
data.append('Content-Disposition: form-data; name="%s"\r\n' % 'return_attributes')
data.append(
"gender,age,smiling,headpose,facequality,blur,eyestatus,emotion,ethnicity,beauty,mouthstatus,eyegaze,skinstatus")
data.append('--%s--\r\n' % boundary)
for i, d in enumerate(data):
if isinstance(d, str):
data[i] = d.encode('utf-8')
http_body = b'\r\n'.join(data)
# build http request
req = urllib.request.Request(url=http_url, data=http_body)
# header
req.add_header('Content-Type', 'multipart/form-data; boundary=%s' % boundary)
try:
# post data to server
resp = urllib.request.urlopen(req, timeout=5)
# get response
qrcont = resp.read()
# if you want to load as json, you should decode first,
# for example: json.loads(qrount.decode('utf-8'))
result = qrcont.decode('utf-8')
result_json = json.loads(result)
print(json.dumps(result_json, indent=2))
except urllib.error.HTTPError as e:
result = e.read().decode('utf-8')
print(json.dumps(result, indent=2))
|
[
"dingzhx@vip.qq.com"
] |
dingzhx@vip.qq.com
|
779966906bddd6b8136f5b50be49cdd1090534ee
|
b9f5bed67a7e2afefe3fd759c78eeed4d10881f6
|
/django_app/introduction_to_models/migrations/0001_initial.py
|
bf3e3ef02e026969fdfab0bb88d03d964bd76890
|
[] |
no_license
|
jmnghn/Django-Documentation-Practice
|
672c1cc9e37ffeff5f08029f45bf580de923422b
|
2106881c415e6e39ba14dc5ba6aa9ac1430de327
|
refs/heads/master
| 2022-09-29T17:30:36.860197
| 2017-06-08T05:09:12
| 2017-06-08T05:09:12
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 614
|
py
|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-05 18:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Person',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=60)),
('shirt_size', models.CharField(max_length=1)),
],
),
]
|
[
"joengmyeonghyeon@gmail.com"
] |
joengmyeonghyeon@gmail.com
|
102e1c8facf01163849e905d9a46995b66eebf28
|
c50d716910e4d51ebfc24ca8a50abe4842b63b5d
|
/train_tp_sort_wiki.py
|
a37081f7b92bac6d3cbbd87f54ed4657078c4ad5
|
[
"MIT"
] |
permissive
|
SkyrookieYu/manga_ordering
|
b504d1a78e26351adb7d00a1ab8a4929854cc4b7
|
8957e9efc0bed68636bc9898dda056963e214663
|
refs/heads/main
| 2023-03-22T14:12:16.399591
| 2021-03-17T09:17:40
| 2021-03-17T09:17:40
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 722
|
py
|
from transformers import Trainer, TrainingArguments
from data.dataloaders import PairwiseWikiData
from models.tpsortmodels import base_order_model
train_set = PairwiseWikiData("jawiki/japanese_wiki_paragraphs.json", divisions=10)
model = base_order_model()
training_args = TrainingArguments(
output_dir="ckpt",
num_train_epochs=3,
per_device_train_batch_size=40,
learning_rate=5e-6,
warmup_steps=500,
weight_decay=0.01,
logging_dir='./logs',
logging_steps=len(train_set) // 200 + 1,
save_steps=len(train_set) // 200 + 1,
save_total_limit=2,
dataloader_num_workers=4
)
trainer = Trainer(
model=model,
args=training_args,
train_dataset=train_set
)
trainer.train()
|
[
"brian01.lim@gmail.com"
] |
brian01.lim@gmail.com
|
c4f5690140458bce0d536cfefba6636c3535c9ad
|
fb3439159a8bd88fd380b0e3fea435ddd4e6e45a
|
/doge/common/utils.py
|
4bbfede249a45b70aa72dc2edbd57b2757e10776
|
[
"Apache-2.0"
] |
permissive
|
qyt2018/doge
|
6ab3aca5424dfa258fef6ea0db0b5f451c0cd430
|
54ba17f9e997e468ab0d7af15e5ef7f45b19e3d6
|
refs/heads/master
| 2020-06-28T04:36:44.014286
| 2018-09-30T09:56:31
| 2018-09-30T09:56:31
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,068
|
py
|
# coding: utf-8
import time
from importlib import import_module
from gsocketpool.pool import Pool
def import_string(dotted_path):
"""
Import a dotted module path and return the attribute/class designated by the
last name in the path. Raise ImportError if the import failed.
"""
try:
module_path, class_name = dotted_path.rsplit('.', 1)
except ValueError:
msg = "%s doesn't look like a module path" % dotted_path
raise ImportError(msg)
module = import_module(module_path)
try:
return getattr(module, class_name)
except AttributeError:
msg = 'Module "%s" does not define a "%s" attribute/class' % (
dotted_path, class_name)
raise ImportError(msg)
def time_ns():
s, n = ("%.20f" % time.time()).split('.')
return int(s) * 1e9 + int(n[:9])
def str_to_host(s):
h, p = s.split(":")
return (str(h), int(p))
class ConnPool(Pool):
def _create_connection(self):
conn = self._factory(**self._options)
# conn.open()
return conn
|
[
"zhu327@gmail.com"
] |
zhu327@gmail.com
|
de06ca34f13b2eff76f8484c8cfac851d34f872f
|
b76615ff745c6d66803506251c3d4109faf50802
|
/pyobjc-core/Examples/Scripts/signal-demo.py
|
afb61eef5d6ca835e627d2ec0eb4ac0224ec8008
|
[
"MIT"
] |
permissive
|
danchr/pyobjc-git
|
6ef17e472f54251e283a0801ce29e9eff9c20ac0
|
62b787fddeb381184043c7ff136f1c480755ab69
|
refs/heads/master
| 2021-01-04T12:24:31.581750
| 2020-02-02T20:43:02
| 2020-02-02T20:43:02
| 240,537,392
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 481
|
py
|
#!/usr/bin/python
from PyObjCTools import Signals
Signals.dumpStackOnFatalSignal()
import os
import signal
## all this does is set up an interesting stack to
## to show that a backtrace really is being
## generated. Try commenting out the
## Signals.dumpStackOnFatalSignal() line above and run
## the script again.
def badness():
os.kill(os.getpid(), signal.SIGQUIT)
class Foo:
def baz(self):
badness()
def bar(self):
self.baz()
Foo().bar()
|
[
"ronaldoussoren@mac.com"
] |
ronaldoussoren@mac.com
|
c63083f09d069c34cd302857d6198be2df11afbb
|
ec5ec1bcfb3f82048fd2703eed6e6fbbcd352bb1
|
/add_digits.py
|
caac8cd0f8e2fffc17fe8a9f08b53af07dcbde30
|
[] |
no_license
|
claytonjwong/Sandbox-Python
|
5e9da26374b178831ca60beaabfbdd2f423032a2
|
b155895c90169ec97372b2517f556fd50deac2bc
|
refs/heads/master
| 2021-06-21T15:37:47.918514
| 2017-08-06T23:58:15
| 2017-08-06T23:58:15
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,305
|
py
|
"""
258. Add Digits
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.
For example:
Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it.
"""
class Solution(object):
def addDigits(self, num):
"""
:type num: int
:rtype: int
"""
sum = 0
while True:
#
# add up each decimal position from right-to-left
#
sum += num % 10
num //= 10
#
# when there are no decimal positions left,
# see if the sum is greater than a single decimal digit
# if so, then reset num to sum and reset sum to 0
#
# return sum when there are no decimal positions left
# and sum is a single decimal digit
#
if num == 0 and sum >= 10:
num = sum
sum = 0
elif num == 0 and sum < 10:
break
return sum
def main():
solution = Solution()
# import pdb
# pdb.set_trace()
print ( str ( " 2 == " + str ( solution.addDigits(38) )) )
if __name__ == "__main__":
main()
|
[
"claytonjwong@gmail.com"
] |
claytonjwong@gmail.com
|
5a0895c4e62c422e5190c377fea47fb15b49962b
|
e3b5e20bcb560a3c37c09f728b9340b1715c1818
|
/venv/chartsHelper.py
|
6e45eeba0e71efe34c8f587f1e3b0a11ef91c189
|
[
"MIT"
] |
permissive
|
180Studios/LoginApp
|
63bc50b1f91e7221c7581627ab166eeb01758f5c
|
66ff684a81b23d8f45eef2c56be19a2afd95ab29
|
refs/heads/master
| 2022-12-24T00:33:08.481826
| 2020-02-03T05:14:41
| 2020-02-03T05:14:41
| 144,414,562
| 0
| 1
|
MIT
| 2022-12-08T01:38:26
| 2018-08-11T19:57:44
|
Python
|
UTF-8
|
Python
| false
| false
| 5,043
|
py
|
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import plotly.graph_objs as go
import numpy, pandas
from tinydb import *
from tinydb.operations import decrement
import re
from datetime import datetime
import config
# init_notebook_mode(connected=True)
# logfile = "log.json"
try:
logfile = "/Users/kylenahas/Desktop/180LoginV1/db/log.json"
except:
logfile = "./log.json"
def simple_chart():
trace0 = go.Bar(
x=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
y=[3, 1, 6, 3, 2, 5],
name="Punchcard Members"
)
trace1 = go.Bar(
x=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
y=[2, 3, 4, 1, 5, 1],
name="Monthly Members"
)
data = [trace0, trace1]
layout = go.Layout(
barmode='stack'
)
fig = go.Figure(data=data, layout=layout)
return fig
class chartsHelper:
def __init__(self, log=None):
if not log:
self.log = logfile
try:
self.log = log
self.logDB = TinyDB(self.log)
except FileNotFoundError as e:
print("Invalid logfile")
# self.get_entries_of_member_type()
def get_entries_of_member_type(self):
member_query = Query()
print(self.logDB.all())
def calculate_attendence(self, start_date=None, period=None):
# zeros = numpy.zeros((7,), dtype=int)
# self.attendance = {}
# # self.attendance = {k:numpy.zeros((7,), dtype=int) for k in config.member_types.keys()} # https://stackoverflow.com/a/483833
# for member_type_k in config.member_types.keys():
# # print(member_type_k)
# self.attendance.update({member_type_k: zeros})
self.attendance = { "punchcard": [0, 0, 0, 0, 0, 0, 0, 0],
"monthly": [0, 0, 0, 0, 0, 0, 0, 0],
"annual": [0, 0, 0, 0, 0, 0, 0, 0],
"student": [0, 0, 0, 0, 0, 0, 0, 0],
"student_annual": [0, 0, 0, 0, 0, 0, 0, 0],
"volunteer": [0, 0, 0, 0, 0, 0, 0, 0],
"trial": [0, 0, 0, 0, 0, 0, 0, 0],
"organization": [0, 0, 0, 0, 0, 0, 0, 0] }
for entry in self.logDB:
# print(entry)
dt = datetime.strptime(entry['log_time'], '%Y-%m-%d %H:%M:%S.%f')
wd = dt.weekday()
member_type_str = "punchcard"
try:
member_type_str = entry['member_type_str']
except:
pass
self.attendance[member_type_str][wd] += 1
return self.attendance
def create_attendence_chart(self):
trace0 = go.Bar(
x=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
y=self.attendance['punchcard'],
name="Punchcard Members"
)
trace1 = go.Bar(
x=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
y=self.attendance['monthly'],
name="Monthly Members"
)
trace2 = go.Bar(
x=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
y=self.attendance['annual'],
name="Annual Members"
)
trace3 = go.Bar(
x=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
y=self.attendance['student'],
name="Student Members"
)
trace4 = go.Bar(
x=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
y=self.attendance['volunteer'],
name="Volunteer Members"
)
trace5 = go.Bar(
x=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
y=self.attendance['organization'],
name="Organization Members"
)
data = [trace0, trace1, trace2, trace3, trace4, trace5]
layout = go.Layout(
barmode='stack'
)
fig = go.Figure(data=data, layout=layout)
return fig
def panda_tests(self):
# print(self.logDB.all())
pandas.set_option('display.max_colwidth', -1)
pandas.set_option('display.max_columns', None)
df = pandas.DataFrame(self.logDB.all())
# for entry in self.logDB:
# df.append(entry, ignore_index=True)
# pd = pandas.read_json(self.logDB.all(), orient='index')
df['log_time'] = pandas.to_datetime(df['log_time'])
df['weekday'] = df['log_time'].apply(lambda x: x.isoweekday())
df.set_index("log_time", inplace=True)
print(df.columns)
print(df.head(10))
print(df.groupby("id").count())
if __name__ == '__main__':
ch = chartsHelper(log="/Users/kylenahas/Desktop/180LoginV1/db/log-mar19.json")
# ch.calculate_attendence()
# plot(ch.create_attendence_chart())
ch.panda_tests()
|
[
"kylenahas@gmail.com"
] |
kylenahas@gmail.com
|
780bb620af4b7428a5557874d2bdfa66ea855a23
|
f159aeec3408fe36a9376c50ebb42a9174d89959
|
/155.Min-Stack.py
|
b754b734b48a4ed9bde782e3396b70e1bcdc3b49
|
[
"MIT"
] |
permissive
|
mickey0524/leetcode
|
83b2d11ab226fad5da7198bb37eeedcd8d17635a
|
fc5b1744af7be93f4dd01d6ad58d2bd12f7ed33f
|
refs/heads/master
| 2023-09-04T00:01:13.138858
| 2023-08-27T07:43:53
| 2023-08-27T07:43:53
| 140,945,128
| 27
| 9
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,210
|
py
|
# https://leetcode.com/problems/min-stack/
#
# algorithms
# Easy (34.63%)
# Total Accepted: 248,646
# Total Submissions: 718,028
from collections import deque
class MinStack(object):
def __init__(self):
"""
initialize your data structure here.
"""
self.data_stack = deque()
self.min_stack = deque()
def push(self, x):
"""
:type x: int
:rtype: void
"""
self.data_stack.append(x)
if len(self.min_stack) == 0:
self.min_stack.append(x)
elif x < self.min_stack[-1]:
self.min_stack.append(x)
else:
self.min_stack.append(self.min_stack[-1])
def pop(self):
"""
:rtype: void
"""
self.data_stack.pop()
self.min_stack.pop()
def top(self):
"""
:rtype: int
"""
return self.data_stack[-1]
def getMin(self):
"""
:rtype: int
"""
return self.min_stack[-1]
# Your MinStack object will be instantiated and called as such:
# obj = MinStack()
# obj.push(x)
# obj.pop()
# param_3 = obj.top()
# param_4 = obj.getMin()
|
[
"buptbh@163.com"
] |
buptbh@163.com
|
0af0dc31c6a079c69e9a0f69496bf6df0961e7c6
|
ca7aa979e7059467e158830b76673f5b77a0f5a3
|
/Python_codes/p03340/s906430612.py
|
4d68664a5cd6e13092a6416dfbf996907ce79293
|
[] |
no_license
|
Aasthaengg/IBMdataset
|
7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901
|
f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8
|
refs/heads/main
| 2023-04-22T10:22:44.763102
| 2021-05-13T17:27:22
| 2021-05-13T17:27:22
| 367,112,348
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 325
|
py
|
n = int(input())
A = list(map(int, input().split()))
xsum = A[0]
asum = A[0]
ans = 0
left, right = 0, 0
while True:
if xsum == asum:
ans += right - left + 1
right += 1
if right == n:
break
asum += A[right]
xsum ^= A[right]
else:
asum -= A[left]
xsum ^= A[left]
left += 1
print(ans)
|
[
"66529651+Aastha2104@users.noreply.github.com"
] |
66529651+Aastha2104@users.noreply.github.com
|
36ee40b2872c91989b80744c751f87cf778217c5
|
1617bd9db97c0989679ea3fe8ab25506332443bf
|
/runserver.py
|
de6eb2856c62d5469ec80b592ab245ba4da84ea7
|
[] |
no_license
|
florije1988/flaskapp
|
3da7ca00d36121148b1ebd3fe8417d796a474b91
|
7f5eed9c2c1e3c6d2eeb6f1b457770106b2bf254
|
refs/heads/master
| 2021-01-25T12:14:14.984931
| 2015-09-04T07:29:45
| 2015-09-04T07:29:45
| 41,535,709
| 1
| 1
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 131
|
py
|
# -*- coding: utf-8 -*-
__author__ = 'florije'
from intro_to_flask import app
if __name__ == '__main__':
app.run(debug=True)
|
[
"florije1988@gmail.com"
] |
florije1988@gmail.com
|
fc9a5598659638528728a6c4cf1799567d39fe30
|
cd8a143c5f01fcf6130b129a7a578d0225476b2d
|
/worker/deps/gyp/test/mac/gyptest-app-error.py
|
df0781d45562a8225855c79fbe1381317035a652
|
[
"BSD-3-Clause",
"ISC"
] |
permissive
|
corvaxx/mediasoup
|
47242bd5b0468b1f7e6de8077b11adf562aa244f
|
304bce884755243f78ba3eeec5442888ecdc5340
|
refs/heads/v3
| 2023-02-05T03:19:59.451099
| 2020-09-25T11:27:36
| 2020-09-25T11:27:36
| 303,987,529
| 0
| 3
|
ISC
| 2020-11-06T16:22:36
| 2020-10-14T11:00:43
| null |
UTF-8
|
Python
| false
| false
| 1,321
|
py
|
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies that invalid strings files cause the build to fail.
"""
from __future__ import print_function
import TestCmd
import TestGyp
import sys
if sys.platform == 'darwin':
print("This test is currently disabled: https://crbug.com/483696.")
sys.exit(0)
expected_error = 'Old-style plist parser: missing semicolon in dictionary'
saw_expected_error = [False] # Python2 has no "nonlocal" keyword.
def match(a, b):
if a == b:
return True
if not TestCmd.is_List(a):
a = a.split('\n')
if not TestCmd.is_List(b):
b = b.split('\n')
if expected_error in '\n'.join(a) + '\n'.join(b):
saw_expected_error[0] = True
return True
return False
test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'], match=match)
test.run_gyp('test-error.gyp', chdir='app-bundle')
test.build('test-error.gyp', test.ALL, chdir='app-bundle')
# Ninja pipes stderr of subprocesses to stdout.
if test.format in ['ninja', 'xcode-ninja'] \
and expected_error in test.stdout():
saw_expected_error[0] = True
if saw_expected_error[0]:
test.pass_test()
else:
test.fail_test()
|
[
"ibc@aliax.net"
] |
ibc@aliax.net
|
ed7afc9075c01158b21a3ec97fa1073c5c131a16
|
98eb51d47082627353cfea31f022ada7ccc6729e
|
/exer_2_aug24.py
|
2f6e26521ee285d9a797abe59c8e1b671ae4ada3
|
[] |
no_license
|
pns845/Dictionary_Practice
|
0c4fe3bb0e845d7c8b53d4cc74848a1549dbe262
|
1e98357dd59679587683f5daad730e3690192627
|
refs/heads/master
| 2022-12-11T07:27:51.574009
| 2020-08-25T17:21:01
| 2020-08-25T17:21:01
| 290,277,781
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 520
|
py
|
import sys
db_1 = {1: {'Interface':'Ethernet0', 'IP':'1.1.1.1' , 'Status':'up' },
2: {'Interface':'Ethernet1', 'IP':'2.2.2.2' , 'Status': 'down'},
3: {'Interface': 'Serial0', 'IP': '3.3.3.3', 'Status': 'up'},
4: {'Interface': 'Serial1', 'IP': '4.4.4.4', 'Status': 'up'}}
interface = sys.argv[1]
print(interface)
for key in db_1:
print("values:", db_1[key]['Interface'], interface)
if db_1[key]['Interface']== interface:
print("status value for Ethernet-1 is"+db_1[key]['Status'])
|
[
"noreply@github.com"
] |
pns845.noreply@github.com
|
fc235403436e30bd87e18d8e4efbaf1982e0c9c7
|
3a9b154aa9d5e379683476f80f30630bf44d2102
|
/Server_v1/appfront/forms/BusinessReportForm.py
|
6318e4cf6d647ad833278a7755537c5966e237a0
|
[] |
no_license
|
KevinDon/py_amazon_analysis
|
81995e360d2b536e1df6e515aae9457054edae29
|
13b5fbb046ca6516ac3a47e8f7867baf358011f4
|
refs/heads/master
| 2022-12-13T00:27:27.511783
| 2019-08-14T11:45:53
| 2019-08-14T11:45:53
| 185,160,162
| 0
| 1
| null | 2022-12-10T05:38:15
| 2019-05-06T08:56:40
|
TSQL
|
UTF-8
|
Python
| false
| false
| 1,417
|
py
|
# coding:utf-8
import datetime
from django import forms
from django.utils.translation import ugettext as _
from appfront.model import BusinessReportModel
class BusinessReportForm(forms.ModelForm):
class Meta:
model = BusinessReportModel
fields = '__all__'
def __init__(self, *args, **kwargs):
super(BusinessReportForm, self).__init__(*args, **kwargs)
# def has_change_permission(self, request):
# """ ๅๆถๅๅฐ็ผ่พ้ไปถๅ่ฝ """
# return False
#
# def save(self, *args, **kwargs):
# # ๅๅปบ็จๆทๆถ๏ผไธบ็จๆท่ชๅจ็ๆไธชไบบๅฏไธID
# # if not self.pk:
# # # ๅญๅจๅฐฑๆดๆฐ๏ผไธๅญๅจๅฐฑๅๅปบ
# # m = hashlib.md5()
# # m.update(self.username.encode(encoding="utf-8"))
# # self.uid = m.hexdigest()
# # logger.info(self.updated_at)
# logger.info(self)
# # module.updated_at = datetime.datetime.now()
# super(ProductQrcodeModel, self).save(self, *args, **kwargs)
# # super(ProductQrcodeModel, self).save(*args, **kwargs)
# def save_m2m(self, *args, **kwargs):
# print('save_m2m')
def clean_sku(self):
sku = self.cleaned_data.get('sku')
return sku.upper()
def clean_location(self):
location = self.cleaned_data.get('location')
return location.upper() if location is not None else ''
|
[
"kevintang002@gmail.com"
] |
kevintang002@gmail.com
|
8b603e86231d625c9d444794c3acdf9b4ce4ed43
|
4236066bcbd37400172d53382301bf8ac8ee8c40
|
/cookbook/seismic_srtomo_sparse.py
|
82a3eec522f50719b1c59f854ebcdb1f30f9ce51
|
[
"BSD-3-Clause"
] |
permissive
|
imclab/fatiando
|
eaf0e01746f198bbe65e140492a0f62abd299802
|
edad8d020094d8fcda1e61402fcd46b686d6fd56
|
refs/heads/master
| 2020-12-26T03:23:37.984484
| 2013-11-27T23:00:22
| 2013-11-27T23:00:22
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,705
|
py
|
"""
Seismic: 2D straight-ray tomography of large data sets and models using
sparse matrices
Uses synthetic data and a model generated from an image file.
Since the image is big, use sparse matrices and a steepest descent solver
(it doesn't require Hessians).
WARNING: may take a long time to calculate.
"""
import urllib
from os import path
import numpy
from fatiando import mesher, utils, seismic, vis, inversion
area = (0, 100000, 0, 100000)
shape = (100, 100)
model = mesher.SquareMesh(area, shape)
# Fetch the image from the online docs
urllib.urlretrieve(
'http://fatiando.readthedocs.org/en/latest/_static/logo.png', 'logo.png')
model.img2prop('logo.png', 4000, 10000, 'vp')
# Make some travel time data and add noise
src_loc = utils.random_points(area, 200)
rec_loc = utils.circular_points(area, 80, random=True)
srcs, recs = utils.connect_points(src_loc, rec_loc)
ttimes = seismic.ttime2d.straight(model, 'vp', srcs, recs, par=True)
ttimes, error = utils.contaminate(ttimes, 0.01, percent=True,
return_stddev=True)
# Make the mesh
mesh = mesher.SquareMesh(area, shape)
# Since the matrices are big, use the Steepest Descent solver to avoid dealing
# with Hessian matrices. It needs a starting guess, so start with 1000
inversion.gradient.use_sparse()
solver = inversion.gradient.steepest(1000*numpy.ones(mesh.size))
# and run the inversion
estimate, residuals = seismic.srtomo.run(ttimes, srcs, recs, mesh, sparse=True,
solver=solver, smooth=0.01)
# Convert the slowness estimate to velocities and add it the mesh
mesh.addprop('vp', seismic.srtomo.slowness2vel(estimate))
# Calculate and print the standard deviation of the residuals
# it should be close to the data error if the inversion was able to fit the data
print "Assumed error: %f" % (error)
print "Standard deviation of residuals: %f" % (numpy.std(residuals))
vis.mpl.figure(figsize=(14, 5))
vis.mpl.subplot(1, 2, 1)
vis.mpl.axis('scaled')
vis.mpl.title('Vp synthetic model of the Earth')
vis.mpl.squaremesh(model, prop='vp', vmin=4000, vmax=10000,
cmap=vis.mpl.cm.seismic)
cb = vis.mpl.colorbar()
cb.set_label('Velocity')
vis.mpl.points(src_loc, '*y', label="Sources")
vis.mpl.points(rec_loc, '^r', label="Receivers")
vis.mpl.legend(loc='lower left', shadow=True, numpoints=1, prop={'size':10})
vis.mpl.subplot(1, 2, 2)
vis.mpl.axis('scaled')
vis.mpl.title('Tomography result')
vis.mpl.squaremesh(mesh, prop='vp', vmin=4000, vmax=10000,
cmap=vis.mpl.cm.seismic)
cb = vis.mpl.colorbar()
cb.set_label('Velocity')
vis.mpl.figure()
vis.mpl.grid()
vis.mpl.title('Residuals (data with %.4f s error)' % (error))
vis.mpl.hist(residuals, color='gray', bins=15)
vis.mpl.xlabel("seconds")
vis.mpl.show()
vis.mpl.show()
|
[
"leouieda@gmail.com"
] |
leouieda@gmail.com
|
dd9e049b2543768f53963145a7ce82b160deb901
|
9d67cd5f8d3e0ffdd4334a6b9b67c93f8deca100
|
/configs/20171216_example_same_room.py
|
775f154c4a3d840719099431f5d30d10f38d1201
|
[] |
no_license
|
SiyuanLee/caps
|
0c300a8e5a9a661eca4b2f59cd38125ddc35b6d3
|
476802e18ca1c7c88f1e29ed66a90c350aa50c1f
|
refs/heads/master
| 2021-06-20T22:48:16.230354
| 2021-02-22T13:21:57
| 2021-02-22T13:21:57
| 188,695,489
| 1
| 2
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 4,937
|
py
|
"""
This is the example config file
same_room
no parameter share
take a look at transfer_config (differences are there)
"""
import numpy as np
# More one-char representation will be added in order to support
# other objects.
# The following a=10 is an example although it does not work now
# as I have not included a '10' object yet.
a = 10
# This is the map array that represents the map
# You have to fill the array into a (m x n) matrix with all elements
# not None. A strange shape of the array may cause malfunction.
# Currently available object indices are # they can fill more than one element in the array.
# 0: nothing
# 1: wall
# 2: ladder
# 3: coin
# 4: spike
# 5: triangle -------source
# 6: square ------ source
# 7: coin -------- target
# 8: princess -------source
# 9: player # elements(possibly more than 1) filled will be selected randomly to place the player
# unsupported indices will work as 0: nothing
map_array = [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 5, 6, 0, 0, 1, 0, 0, 0, 0, 1],
[1, 9, 9, 9, 9, 1, 9, 9, 9, 8, 1],
[1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1],
[1, 0, 0, 2, 0, 0, 0, 2, 0, 7, 1],
[1, 9, 9, 2, 9, 9, 9, 2, 9, 9, 1],
[1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1],
[1, 0, 2, 0, 1, 0, 2, 0, 0, 0, 1],
[1, 0, 2, 0, 1, 0, 2, 0, 0, 0, 1],
[1, 9, 9, 9, 1, 9, 9, 9, 9, 9, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
]
# set to true -> win when touching the object
# 0, 1, 2, 3, 4, 9 are not possible
end_game = {
5: True,
}
rewards = {
"positive": 0, # when collecting a coin
"win": 1, # endgame (win)
"negative": -25, # endgame (die)
"tick": 0 # living
}
######### dqn only ##########
# ensure correct import
import os
import sys
__file_path = os.path.abspath(__file__)
__dqn_dir = '/'.join(str.split(__file_path, '/')[:-2]) + '/'
sys.path.append(__dqn_dir)
__cur_dir = '/'.join(str.split(__file_path, '/')[:-1]) + '/'
from dqn_utils import PiecewiseSchedule, NoOpWrapperMK
# load the random sampled obs
import pickle
pkl_file = __cur_dir + 'eval_obs_array_random_same.pkl'
with open(pkl_file, 'rb') as f:
eval_obs_array = pickle.loads(f.read())
def seed_func():
return np.random.randint(0, 1000)
num_timesteps = 2e7
learning_freq = 4
# training iterations to go
num_iter = num_timesteps / learning_freq
# piecewise learning rate
lr_multiplier = 1.0
learning_rate = PiecewiseSchedule([
(0, 2e-4 * lr_multiplier),
(num_iter / 2, 1e-4 * lr_multiplier),
(num_iter * 3 / 4, 5e-5 * lr_multiplier),
], outside_value=5e-5 * lr_multiplier)
# piecewise learning rate
exploration = PiecewiseSchedule([
(0, 1.0),
(num_iter / 2, 0.7),
(num_iter * 3 / 4, 0.1),
(num_iter * 7 / 8, 0.05),
], outside_value=0.05)
######### transfer only #########
source_dirs = [
# an old map policy
# '/home/lsy/logs/target6c_12_05_17_21:26:25/dqn',
# '/home/lsy/PycharmProjects/ple-monstrerkong/examples/dqn_new/logs/target5_12_05_17_19:49:45',
# '/home/lsy/target8c_12_10_17_15:25:06/dqn',
'/home/beeperman/Project/ple-monsterkong/examples/dqn_new/logs/same_room_12_12_17_20:54:53/dqn',
#'/home/lsy/same_room_12_12_17_20:54:53/dqn',
]
transfer_config = {
'source_dirs': source_dirs,
'online_q_omega': False, # default false off policy with experience replay
'q_omega_uniform_sample': False, # default false
'four_to_two': False, # default false frame_history_len must be 4!
'source_noop': False, # default false (false means source policies HAS noop action)
'no_share_para': True # default false set to true to stop sharing parameter between q network and q_omega/term
}
dqn_config = {
'seed': seed_func, # will override game settings
'num_timesteps': num_timesteps,
'replay_buffer_size': 1000000,
'batch_size': 32,
'gamma': 0.99,
'learning_starts': 50000,
'learning_freq': learning_freq,
'frame_history_len': 2,
'target_update_freq': 10000,
'grad_norm_clipping': 10,
'learning_rate': learning_rate,
'exploration': exploration,
'additional_wrapper': NoOpWrapperMK,
'eval_obs_array': eval_obs_array, # TODO: construct some eval_obs_array
'room_q_interval': 1e4, # q_vals will be evaluated every room_q_interval steps
'epoch_size': 5e4, # you decide any way
'config_name': str.split(__file_path, '/')[-1].replace('.py', ''), # the config file name
'transfer_config': transfer_config,
}
map_config = {
'map_array': map_array,
'rewards': rewards,
'end_game': end_game,
'init_score': 0,
'init_lives': 1, # please don't change, not going to work
# configs for dqn
'dqn_config': dqn_config,
# work automatically only for aigym wrapped version
'fps': 1000,
'frame_skip': 1,
'force_fps': True, # set to true to make the game run as fast as possible
'display_screen': True,
'episode_length': 1200,
'episode_end_sleep': 0., # sec
}
|
[
"lisiyuan@bupt.edu.cn"
] |
lisiyuan@bupt.edu.cn
|
bd79ec0757f648e401c63f9fa0942494e20dc519
|
ca7aa979e7059467e158830b76673f5b77a0f5a3
|
/Python_codes/p03611/s342764728.py
|
5355e439cbc0315cffc195524b903f5e9f4c1700
|
[] |
no_license
|
Aasthaengg/IBMdataset
|
7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901
|
f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8
|
refs/heads/main
| 2023-04-22T10:22:44.763102
| 2021-05-13T17:27:22
| 2021-05-13T17:27:22
| 367,112,348
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 187
|
py
|
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
l=[]
for x in a:
l.append(x-1)
l.append(x)
l.append(x+1)
print(Counter(l).most_common(1)[0][1])
|
[
"66529651+Aastha2104@users.noreply.github.com"
] |
66529651+Aastha2104@users.noreply.github.com
|
ae35aec52d86a32bd0b75f1acf50678710a9f641
|
163bbb4e0920dedd5941e3edfb2d8706ba75627d
|
/Code/CodeRecords/2791/60695/239354.py
|
6b532a321bf527606eb34026bc1d2b58906786af
|
[] |
no_license
|
AdamZhouSE/pythonHomework
|
a25c120b03a158d60aaa9fdc5fb203b1bb377a19
|
ffc5606817a666aa6241cfab27364326f5c066ff
|
refs/heads/master
| 2022-11-24T08:05:22.122011
| 2020-07-28T16:21:24
| 2020-07-28T16:21:24
| 259,576,640
| 2
| 1
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 242
|
py
|
n = int(input())
a = input().split(" ")
count = 0
for i in range(0, n):
if a[i] == "1":
count += 1
print(count)
for i in range(0, n):
if i == n-1:
print(a[i])
elif a[i + 1] == "1":
print(a[i] + " ", end="")
|
[
"1069583789@qq.com"
] |
1069583789@qq.com
|
f5751fcb1dace35e1e62379427c047c026646cf0
|
49a167d942f19fc084da2da68fc3881d44cacdd7
|
/kubernetes_asyncio/test/test_v1beta2_replica_set_list.py
|
271452437d4493d410a2e9bcc3923ad1bcec5d20
|
[
"Apache-2.0"
] |
permissive
|
olitheolix/kubernetes_asyncio
|
fdb61323dc7fc1bade5e26e907de0fe6e0e42396
|
344426793e4e4b653bcd8e4a29c6fa4766e1fff7
|
refs/heads/master
| 2020-03-19T12:52:27.025399
| 2018-06-24T23:34:03
| 2018-06-24T23:34:03
| 136,546,270
| 1
| 0
|
Apache-2.0
| 2018-06-24T23:52:47
| 2018-06-08T00:39:52
|
Python
|
UTF-8
|
Python
| false
| false
| 1,038
|
py
|
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1.10.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import kubernetes_asyncio.client
from kubernetes_asyncio.client.models.v1beta2_replica_set_list import V1beta2ReplicaSetList # noqa: E501
from kubernetes_asyncio.client.rest import ApiException
class TestV1beta2ReplicaSetList(unittest.TestCase):
"""V1beta2ReplicaSetList unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testV1beta2ReplicaSetList(self):
"""Test V1beta2ReplicaSetList"""
# FIXME: construct object with mandatory attributes with example values
# model = kubernetes_asyncio.client.models.v1beta2_replica_set_list.V1beta2ReplicaSetList() # noqa: E501
pass
if __name__ == '__main__':
unittest.main()
|
[
"tomasz.prus@gmail.com"
] |
tomasz.prus@gmail.com
|
1c213bc633cad5adec5b1c8e8eb5afab1fe602e4
|
add74ecbd87c711f1e10898f87ffd31bb39cc5d6
|
/xcp2k/classes/_shg_integrals_test1.py
|
097a0b17deff2c1c43c55c874d8ca09dd08c8970
|
[] |
no_license
|
superstar54/xcp2k
|
82071e29613ccf58fc14e684154bb9392d00458b
|
e8afae2ccb4b777ddd3731fe99f451b56d416a83
|
refs/heads/master
| 2021-11-11T21:17:30.292500
| 2021-11-06T06:31:20
| 2021-11-06T06:31:20
| 62,589,715
| 8
| 2
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,744
|
py
|
from xcp2k.inputsection import InputSection
from xcp2k.classes._basis1 import _basis1
class _shg_integrals_test1(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Section_parameters = None
self.Abc = None
self.Nab_min = None
self.Nrep = None
self.Check_accuracy = None
self.Accuracy_level = None
self.Calculate_derivatives = None
self.Test_overlap = None
self.Test_coulomb = None
self.Test_verf = None
self.Test_verfc = None
self.Test_vgauss = None
self.Test_gauss = None
self.Test_ra2m = None
self.M = None
self.Test_overlap_aba = None
self.Test_overlap_abb = None
self.BASIS_list = []
self._name = "SHG_INTEGRALS_TEST"
self._keywords = {'Abc': 'ABC', 'Nab_min': 'NAB_MIN', 'Nrep': 'NREP', 'Check_accuracy': 'CHECK_ACCURACY', 'Accuracy_level': 'ACCURACY_LEVEL', 'Calculate_derivatives': 'CALCULATE_DERIVATIVES', 'Test_overlap': 'TEST_OVERLAP', 'Test_coulomb': 'TEST_COULOMB', 'Test_verf': 'TEST_VERF', 'Test_verfc': 'TEST_VERFC', 'Test_vgauss': 'TEST_VGAUSS', 'Test_gauss': 'TEST_GAUSS', 'Test_ra2m': 'TEST_RA2M', 'M': 'M', 'Test_overlap_aba': 'TEST_OVERLAP_ABA', 'Test_overlap_abb': 'TEST_OVERLAP_ABB'}
self._repeated_subsections = {'BASIS': '_basis1'}
self._attributes = ['Section_parameters', 'BASIS_list']
def BASIS_add(self, section_parameters=None):
new_section = _basis1()
if section_parameters is not None:
if hasattr(new_section, 'Section_parameters'):
new_section.Section_parameters = section_parameters
self.BASIS_list.append(new_section)
return new_section
|
[
"xingwang1991@gmail.com"
] |
xingwang1991@gmail.com
|
d7e3eee3c33f77ccf4b9aac394c4a45f5bbbac0d
|
7e7e8fb08e00f235306b97908ae083d670c00062
|
/Froms/1.formpro/formpro/wsgi.py
|
fd61d7862293b341cd7fe21018301878529850b3
|
[] |
no_license
|
Aadeshkale/Django-devlopment
|
b60fd8c846b7187ac7d464839055353e877479e3
|
445e6b65825fe03be34a13b30817adbb160bb608
|
refs/heads/master
| 2021-07-18T13:53:14.216350
| 2020-05-08T07:19:22
| 2020-05-08T07:19:22
| 146,633,868
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 391
|
py
|
"""
WSGI config for formpro project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'formpro.settings')
application = get_wsgi_application()
|
[
"aadeshkale0@gmail.com"
] |
aadeshkale0@gmail.com
|
f18486755d13b3765b34036f097c316cfe0d6f99
|
5ad74a3b997b25d3c3aac3bd27d30876ec5d9304
|
/python/brenmy/geometry/bmMesh.py
|
cb695ed57c087ed557c4d719d62baf2c44e91c51
|
[] |
no_license
|
lwk205/brenmy
|
c587ee56c22cd4332878c980af14362453add8ee
|
16e4c3e978699e398fdc76611cda39ce39da0e33
|
refs/heads/master
| 2023-01-24T03:09:27.093726
| 2020-11-24T09:56:11
| 2020-11-24T09:56:11
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 555
|
py
|
'''
Created on 23 Jun 2018
@author: Bren
OpenMaya API mesh utilities
'''
from maya.api import OpenMaya
def get_points(mesh):
# get dag
sl = OpenMaya.MSelectionList()
sl.add(mesh)
dag = sl.getDagPath(0)
# get points
m_mesh = OpenMaya.MFnMesh(dag)
points = m_mesh.getVertices()
return points
def set_points(mesh, points):
# get dag
sl = OpenMaya.MSelectionList()
sl.add(mesh)
dag = sl.getDagPath(0)
# get points
m_mesh = OpenMaya.MFnMesh(dag)
m_mesh.setVertices(points)
return True
|
[
"brenainnjordan@googlemail.com"
] |
brenainnjordan@googlemail.com
|
b78cfbb6561597fad5d2bbf609bc75d888603e52
|
1bd5f83d7faf77ad92d141ba07d25259dd2c4550
|
/LeetCode/PascalsTriangle2.py
|
bc8ddfd2de4983224b1bd3dcabeb24d02db6c083
|
[] |
no_license
|
puneet29/algos
|
a0f5d638909c12e86faa5544d0ae7d9381b8f1fc
|
54545a7502f7359968fbd27ec5bf111b82df324d
|
refs/heads/master
| 2021-07-22T22:45:31.745942
| 2021-07-19T18:13:40
| 2021-07-19T18:13:40
| 189,939,790
| 5
| 4
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 316
|
py
|
class Solution:
def getRow(self, rowIndex: int) -> List[int]:
if(rowIndex < 1):
return [1] * (rowIndex + 1)
prev = self.getRow(rowIndex-1)
curr = [1 for i in range(rowIndex+1)]
for i in range(1, rowIndex):
curr[i] = prev[i-1] + prev[i]
return curr
|
[
"puneet29saini@gmail.com"
] |
puneet29saini@gmail.com
|
a0e5c7c8b90240f173efb2e5b446c5fb9cefe55f
|
060fbf2a69a90ad92de5fc877521d5ea6b298007
|
/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/dictionary_wrapper.py
|
6a304de7269c0577cfc4283e6d45211281f132dd
|
[
"MIT",
"LicenseRef-scancode-generic-cla"
] |
permissive
|
iscai-msft/autorest.python
|
db47a8f00253148fbc327fe0ae1b0f7921b397c6
|
a9f38dd762fbc046ce6197bfabea2f56045d2957
|
refs/heads/master
| 2021-08-02T13:06:34.768117
| 2018-11-21T00:29:31
| 2018-11-21T00:29:31
| 161,554,205
| 0
| 0
|
MIT
| 2018-12-12T22:42:14
| 2018-12-12T22:42:14
| null |
UTF-8
|
Python
| false
| false
| 913
|
py
|
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class DictionaryWrapper(Model):
"""DictionaryWrapper.
:param default_program:
:type default_program: dict[str, str]
"""
_attribute_map = {
'default_program': {'key': 'defaultProgram', 'type': '{str}'},
}
def __init__(self, **kwargs):
super(DictionaryWrapper, self).__init__(**kwargs)
self.default_program = kwargs.get('default_program', None)
|
[
"noreply@github.com"
] |
iscai-msft.noreply@github.com
|
3f6e4a8e9423724fa17c503ff03fce2fe280d2bd
|
c548c10c4fd0b6c1d1c10cc645cb3b90b31f2de6
|
/keras2/keras83_embedding1.py
|
4867bc0bbc211ed5091a7697040ae28f561545ad
|
[] |
no_license
|
sswwd95/Study
|
caf45bc3c8c4301260aaac6608042e53e60210b6
|
3c189090c76a68fb827cf8d6807ee1a5195d2b8b
|
refs/heads/master
| 2023-06-02T21:44:00.518810
| 2021-06-26T03:01:26
| 2021-06-26T03:01:26
| 324,061,105
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 5,648
|
py
|
from tensorflow.keras.preprocessing.text import Tokenizer
import numpy as np
docs = ['๋๋ฌด ์ฌ๋ฐ์ด์', '์ฐธ ์ต๊ณ ์์', '์ฐธ ์ ๋ง๋ ์ํ์์',
'์ถ์ฒํ๊ณ ์ถ์ ์ํ์
๋๋ค.', ' ํ ๋ฒ ๋ ๋ณด๊ณ ์ถ๋ค์', '๊ธ์์',
'๋ณ๋ก์์', '์๊ฐ๋ณด๋ค ์ง๋ฃจํด์', '์ฐ๊ธฐ๊ฐ ์ด์ํด์',
'์ฌ๋ฏธ์์ด์', '๋๋ฌด ์ฌ๋ฏธ์๋ค', '์ฐธ ์ฌ๋ฐ๋ค์', '๋ณ์ด๋ ์์ ๊ท์ฌ์์']
# ๊ธ์ 1, ๋ถ์ 0
labels = np.array([1,1,1,1,1,0,0,0,0,0,0,1,1])
token = Tokenizer()
token.fit_on_texts(docs)
print(token.word_index)
'''
{'์ฐธ': 1, '๋๋ฌด': 2, '์ฌ๋ฐ์ด์': 3, '์ต๊ณ ์์': 4, '์': 5, '๋ง๋ ': 6, '์ํ์์': 7, '์ถ์ฒํ๊ณ ': 8,
'์ถ์': 9, '์ํ์
๋๋ค': 10, 'ํ': 11, '๋ฒ': 12, '๋': 13, '๋ณด๊ณ ': 14, '์ถ๋ค์': 15, '๊ธ์์': 16, '
๋ณ๋ก์์': 17, '์๊ฐ๋ณด๋ค': 18, '์ง๋ฃจํด์': 19, '์ฐ๊ธฐ๊ฐ': 20, '์ด์ํด์': 21, '์ฌ๋ฏธ์์ด์': 22, '์ฌ๋ฏธ
์๋ค': 23, '์ฌ๋ฐ๋ค์': 24, '๋ณ์ด๋': 25, '์์ ': 26, '๊ท์ฌ์์': 27}
'''
x = token.texts_to_sequences(docs)
print(x)
# [[2, 3], [1, 4], [1, 5, 6, 7], [8, 9, 10], [11, 12, 13, 14, 15], [16], [17], [18, 19], [20, 21], [22], [2, 23], [1, 24], [25, 26, 27]]# ํฌ๊ธฐ๊ฐ ์ผ์ ํ์ง ์์ ๋ชจ๋ธ๋ง ํ ์ ์๋ค. ๊ธธ์ด๋ฅผ ์ผ์ ํ๊ฒ ๋ง์ถฐ์ฃผ๋ ค๋ฉด? ๊ธด ๊ธ์์ ๋ง๊ฒ ํ๊ณ ๋น์๋ฆฌ๋ 0์ผ๋ก ์ฑ์ด๋ค.
from tensorflow.keras.preprocessing.sequence import pad_sequences # 2์ฐจ, 3์ฐจ ๊ฐ๋ฅ
pad_x = pad_sequences(x, padding='pre') # ์์ชฝ์ 0
# pad_x = pad_sequences(x, padding='post') # ๋ค์ชฝ์ 0
print(pad_x)
# pre
'''
[[ 0 0 0 2 3]
[ 0 0 0 1 4]
[ 0 1 5 6 7]
[ 0 0 8 9 10]
[11 12 13 14 15]
[ 0 0 0 0 16]
[ 0 0 0 0 17]
[ 0 0 0 18 19]
[ 0 0 0 20 21]
[ 0 0 0 0 22]
[ 0 0 0 2 23]
[ 0 0 0 1 24]
[ 0 0 25 26 27]]
'''
# post
'''
[[ 0 0 2 3]
[ 0 0 1 4]
[ 1 5 6 7]
[ 0 8 9 10]
[12 13 14 15]
[ 0 0 0 16]
[ 0 0 0 17]
[ 0 0 18 19]
[ 0 0 20 21]
[ 0 0 0 22]
[ 0 0 2 23]
[ 0 0 1 24]
[ 0 25 26 27]]
'''
print(pad_x.shape) #(13, 5)
pad_x = pad_sequences(x,maxlen=5, truncating='pre',padding='pre')
# maxlen => ๋ด๊ฐ ์ํ๋ ๊ธธ์ด๋ก ์๋ฅธ๋ค
# truncating='pre' : ์์ชฝ์ ์๋ฅธ๋ค
# truncating='post' : ๋ท์ชฝ์ ์๋ฅธ๋ค
print(pad_x)
print(np.unique(pad_x))
# [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
# 24 25 26 27]
print(len(np.unique(pad_x))) #28
# 0๋ถํฐ 27๊น์ง์ธ๋ฐ 11์ด maxlen=4๋ก ์ธํด ์๋ ธ๋ค.
'''
์ํซ์ธ์ฝ๋ฉ์ ๊ทธ๋๋ก ์ฌ์ฉํ๋ฉด ๋ฒกํฐ์ ๊ธธ์ด๊ฐ ๋๋ฌด ๊ธธ์ด์ง๋ค.
๋ง์ฝ ๋ง ๊ฐ์ ๋จ์ด ํ ํฐ์ผ๋ก ์ด๋ฃจ์ด์ง ๋ง๋ญ์น๋ฅผ ๋ค๋ฃฌ๋ค๊ณ ํ ๋,
๋ฒกํฐํ ํ๋ฉด 9,999๊ฐ์ 0๊ณผ ํ๋์ 1๋ก ์ด๋ฃจ์ด์ง ๋จ์ด ๋ฒกํธ๋ฅผ 1๋ง๊ฐ๋ฅผ ๋ง๋ค์ด์ผ ํ๋ค.
์ด๋ฌํ ๊ณต๊ฐ์ ๋ญ๋น๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด ๋ฑ์ฅํ ๊ฒ์ด ๋จ์ด ์๋ฒ ๋ฉ
'''
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Embedding, Dense, LSTM, Flatten, Conv1D
model = Sequential()
# model.add(Embedding(input_dim=28, output_dim=11, input_length=5))
model.add(Embedding(28,11))
# output_dim=11 : ๋ค์ ๋ ์ด์ด๋ก ๋๊ฒจ์ฃผ๋ ๋
ธ๋์ ๊ฐฏ์. ์์๋ก ์ง์ ๊ฐ๋ฅ. ์ค์ ๋จ์ด์ ๊ฐฏ์
# input_length=5 : pad_x.shape์ ๋ค์ ์๋ ๊ฐ
# embeddingํจ์๊ฐ np.unique(pad_x) ๊ณ์ฐํ๊ธฐ ๋๋ฌธ์ 27๋ก ๋ฃ์ผ๋ฉด ์ค๋ฅ. ์ค์ ๋จ์ด์ ๊ฐฏ์๋ณด๋ค ๊ฐ๊ฑฐ๋ ์ปค์ผํ๋ค.
# Embedding์ 3์ฐจ๋ก ๋ฐ์์ 3์ฐจ๋ก ๋๊ฐ๋ค.
model.add(LSTM(32))
# LSTM์ 3์ฐจ๋ก ๋ฐ์์ 2์ฐจ๋ก ๋๊ฐ๋ค.
model.add(Dense(1, activation='sigmoid'))
# model.add(Flatten())
# model.add(Dense(1))
model.summary()
'''
Layer (type) Output Shape Param #
=================================================================
embedding (Embedding) (None, 5, 11) 308
_________________________________________________________________
flatten (Flatten) (None, 55) 0
_________________________________________________________________
dense (Dense) (None, 1) 56
=================================================================
Total params: 364
Trainable params: 364
Non-trainable params: 0
_________________________________________________________________
'''
# model.add(Embedding(28,11))
'''
Layer (type) Output Shape Param #
=================================================================
embedding (Embedding) (None, None, 11) 308
=================================================================
Total params: 308
Trainable params: 308
Non-trainable params: 0
_________________________________________________________________
'''
# param ์ 308? input_dim*output_dim (28*11 = 308)
# input_length์ ์ํฅ์ด ์๋ค.
# model.add(LSTM(32))
'''
Layer (type) Output Shape Param #
=================================================================
embedding (Embedding) (None, 5, 11) 308
_________________________________________________________________
lstm (LSTM) (None, 32) 5632
_________________________________________________________________
dense (Dense) (None, 1) 33
=================================================================
Total params: 5,973
Trainable params: 5,973
Non-trainable params: 0
_________________________________________________________________
'''
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['acc'])
model.fit(pad_x, labels, epochs=100)
acc = model.evaluate(pad_x, labels)[1]
print(acc)
# 1.0
|
[
"sswwd95@gmail.com"
] |
sswwd95@gmail.com
|
afe3e972640f342df29ec41f8483b6b5ac8b87da
|
83de24182a7af33c43ee340b57755e73275149ae
|
/aliyun-python-sdk-alb/aliyunsdkalb/request/v20200616/UpdateAScriptsRequest.py
|
0483ef14f68504f3e2d37de9657b8163fe62ec2d
|
[
"Apache-2.0"
] |
permissive
|
aliyun/aliyun-openapi-python-sdk
|
4436ca6c57190ceadbc80f0b1c35b1ab13c00c7f
|
83fd547946fd6772cf26f338d9653f4316c81d3c
|
refs/heads/master
| 2023-08-04T12:32:57.028821
| 2023-08-04T06:00:29
| 2023-08-04T06:00:29
| 39,558,861
| 1,080
| 721
|
NOASSERTION
| 2023-09-14T08:51:06
| 2015-07-23T09:39:45
|
Python
|
UTF-8
|
Python
| false
| false
| 3,065
|
py
|
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from aliyunsdkcore.request import RpcRequest
from aliyunsdkalb.endpoint import endpoint_data
class UpdateAScriptsRequest(RpcRequest):
def __init__(self):
RpcRequest.__init__(self, 'Alb', '2020-06-16', 'UpdateAScripts','alb')
self.set_method('POST')
if hasattr(self, "endpoint_map"):
setattr(self, "endpoint_map", endpoint_data.getEndpointMap())
if hasattr(self, "endpoint_regional"):
setattr(self, "endpoint_regional", endpoint_data.getEndpointRegional())
def get_ClientToken(self): # String
return self.get_query_params().get('ClientToken')
def set_ClientToken(self, ClientToken): # String
self.add_query_param('ClientToken', ClientToken)
def get_AScripts(self): # Array
return self.get_query_params().get('AScripts')
def set_AScripts(self, AScripts): # Array
for index1, value1 in enumerate(AScripts):
if value1.get('AScriptName') is not None:
self.add_query_param('AScripts.' + str(index1 + 1) + '.AScriptName', value1.get('AScriptName'))
if value1.get('AScriptId') is not None:
self.add_query_param('AScripts.' + str(index1 + 1) + '.AScriptId', value1.get('AScriptId'))
if value1.get('ExtAttributeEnabled') is not None:
self.add_query_param('AScripts.' + str(index1 + 1) + '.ExtAttributeEnabled', value1.get('ExtAttributeEnabled'))
if value1.get('ScriptContent') is not None:
self.add_query_param('AScripts.' + str(index1 + 1) + '.ScriptContent', value1.get('ScriptContent'))
if value1.get('ExtAttributes') is not None:
for index2, value2 in enumerate(value1.get('ExtAttributes')):
if value2.get('AttributeValue') is not None:
self.add_query_param('AScripts.' + str(index1 + 1) + '.ExtAttributes.' + str(index2 + 1) + '.AttributeValue', value2.get('AttributeValue'))
if value2.get('AttributeKey') is not None:
self.add_query_param('AScripts.' + str(index1 + 1) + '.ExtAttributes.' + str(index2 + 1) + '.AttributeKey', value2.get('AttributeKey'))
if value1.get('Enabled') is not None:
self.add_query_param('AScripts.' + str(index1 + 1) + '.Enabled', value1.get('Enabled'))
def get_DryRun(self): # Boolean
return self.get_query_params().get('DryRun')
def set_DryRun(self, DryRun): # Boolean
self.add_query_param('DryRun', DryRun)
|
[
"sdk-team@alibabacloud.com"
] |
sdk-team@alibabacloud.com
|
22e9a901d92d103f5fa559120bb1832bbb4c64bb
|
39d8ccea8f164bb25240b7b2ec82d7027bab2e52
|
/venv/bin/markdown_py
|
87d786275b88bdb478b0ff94eb7bfb860b6eaf86
|
[] |
no_license
|
yasin007/YYShop
|
63b4cf6b5c285f78b63dd49c0946f9928dc43fea
|
f2159ab8da11b54e5c224ae2f9b79cee81a67d86
|
refs/heads/master
| 2020-04-04T00:22:31.373194
| 2018-11-01T02:02:16
| 2018-11-01T02:02:16
| 155,647,960
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 246
|
#!/Users/yiyang/Desktop/YYShop/venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from markdown.__main__ import run
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(run())
|
[
"yangyi@gogopay.cn"
] |
yangyi@gogopay.cn
|
|
022010ca59bb2656af4a763f8213b6c1192ebf1b
|
4a0cff7421d20c0826c38f40a7d30a298cdaf23b
|
/app/users/admin.py
|
86ce6ae20b4f28dc77a2a1401e6c91bf50124ad4
|
[
"MIT"
] |
permissive
|
contestcrew/2019SeoulContest-Backend
|
0699dea624386f05526e8b5f3c295839f58f3d05
|
2e99cc6ec6a712911da3b79412ae84a9d35453e1
|
refs/heads/master
| 2021-09-09T10:48:01.214064
| 2019-09-30T06:39:58
| 2019-09-30T06:39:58
| 205,388,431
| 0
| 3
|
MIT
| 2021-06-10T19:07:57
| 2019-08-30T13:31:53
|
Python
|
UTF-8
|
Python
| false
| false
| 271
|
py
|
from django.contrib import admin
from .models import User
class UserAdmin(admin.ModelAdmin):
list_display = ["id", "username", "is_staff", "date_joined"]
search_fields = ["username"]
ordering = ["-id", "date_joined"]
admin.site.register(User, UserAdmin)
|
[
"dreamong91@gmail.com"
] |
dreamong91@gmail.com
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.